org.hecl.files
Class HeclFileUtils
java.lang.Object
org.hecl.files.HeclFileUtils
public class HeclFileUtils
- extends java.lang.Object
The HeclFileUtils
class provides several utility
functions that are used both by FileCmds, and elsewhere in Hecl.
- Version:
- 1.0
- Author:
- David N. Welton
Method Summary |
static Thing |
readFile(java.lang.String filename)
readFile takes a filename and returns the file's
contents as a Thing. |
static Thing |
readFileFromDis(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 void |
sourceFile(Interp interp,
java.lang.String filename)
The sourceFile method takes a file name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HeclFileUtils
public HeclFileUtils()
readFile
public static Thing readFile(java.lang.String filename)
throws HeclException,
java.io.IOException
readFile
takes a filename and returns the file's
contents as a Thing.
- Parameters:
filename
- a String
value
- Returns:
- a
Thing
value
- Throws:
HeclException
- if an error occurs
java.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
- a DataInputStream
value
- Returns:
- a
Thing
value
- Throws:
java.io.IOException
- if an error occurs
sourceFile
public static void sourceFile(Interp interp,
java.lang.String filename)
throws HeclException
- The
sourceFile
method takes a file name. It opens
that file, reads the contents, and evaluates them with the
provided interpreter.
- Parameters:
interp
- an Interp
valuefilename
- a String
value
- Throws:
HeclException
- if an error occurs