org.hecl.files
Class HeclFileUtils
- java.lang.Object
-
- org.hecl.files.HeclFileUtils
-
public class HeclFileUtils extends java.lang.ObjectTheHeclFileUtilsclass provides several utility functions that are used both by FileCmds, and elsewhere in Hecl.
-
-
Constructor Summary
Constructors Constructor and Description HeclFileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static ThingreadFile(java.lang.String filename)readFiletakes a filename and returns the file's contents as a Thing.static ThingreadFileFromDis(java.io.DataInputStream dis)readFileFromDis, given a DataInputStream, reads from the stream until no more can be read, and returns the results as a Thing.static voidsourceFile(Interp interp, java.lang.String filename)ThesourceFilemethod takes a file name.
-
-
-
Method Detail
-
readFile
public static Thing readFile(java.lang.String filename) throws HeclException, java.io.IOException
readFiletakes a filename and returns the file's contents as a Thing.- Parameters:
filename- aStringvalue- Returns:
- a
Thingvalue - Throws:
HeclException- if an error occursjava.io.IOException- if an error occurs
-
readFileFromDis
public static Thing readFileFromDis(java.io.DataInputStream dis) throws java.io.IOException
readFileFromDis, given a DataInputStream, reads from the stream until no more can be read, and returns the results as a Thing.- Parameters:
dis- aDataInputStreamvalue- Returns:
- a
Thingvalue - Throws:
java.io.IOException- if an error occurs
-
sourceFile
public static void sourceFile(Interp interp, java.lang.String filename) throws HeclException
ThesourceFilemethod takes a file name. It opens that file, reads the contents, and evaluates them with the provided interpreter.- Parameters:
interp- anInterpvaluefilename- aStringvalue- Throws:
HeclException- if an error occurs
-
-
DataMelt 3.0 © DataMelt by jWork.ORG