| java.lang.Object org.hecl.files.HeclFile
HeclFile | public class HeclFile implements org.hecl.HeclModule(Code) | | HeclFile implements all the filesystem interaction
methods. It's not used in J2ME code, so we can add all we like
here.
author: David N. Welton version: 1.0 |
Method Summary | |
public static void | changeDir(String dirname) changeDir changes where Java thinks the current
directory is, but DOES NOT CHANGE the process' actual working
directory, so this may cause problems if you exec something. | public static Vector | fileToList(String filename) fileToList splits a path like /a/b/c into the list
{/ a b c} so that it's easy to manipulate programatically. | public static String | listToFile(Vector filenamelist) listToFile takes a list like {a b c} and converts
it to a filename such as a/b/c. | public void | loadModule(Interp interp) | public static StringBuffer | readFile(String filename) readFile reads in a text file, given a filename,
and returns its contents as a StringBuffer. | public static void | sourceFile(Interp interp, String filename) The sourceFile method is the equivalent of the
"source" command. | public void | unloadModule(Interp interp) | public static void | writeFile(String filename, String data) The writeFile method writes the 'data' String to
the file given by 'filename'. |
changeDir | public static void changeDir(String dirname)(Code) | | changeDir changes where Java thinks the current
directory is, but DOES NOT CHANGE the process' actual working
directory, so this may cause problems if you exec something.
Parameters: dirname - a String value |
fileToList | public static Vector fileToList(String filename)(Code) | | fileToList splits a path like /a/b/c into the list
{/ a b c} so that it's easy to manipulate programatically.
Parameters: filename - a String value a Vector value |
listToFile | public static String listToFile(Vector filenamelist)(Code) | | listToFile takes a list like {a b c} and converts
it to a filename such as a/b/c.
Parameters: filenamelist - a Vector value a String value |
readFile | public static StringBuffer readFile(String filename) throws HeclException(Code) | | readFile reads in a text file, given a filename,
and returns its contents as a StringBuffer. FIXME - we
probably ought to do this better, by making it more configurable.
Parameters: filename - a String value a StringBuffer value exception: HeclException - if an error occurs |
sourceFile | public static void sourceFile(Interp interp, String filename) throws HeclException(Code) | | The sourceFile method is the equivalent of the
"source" command.
Parameters: interp - an Interp value Parameters: filename - a String value exception: HeclException - if an error occurs |
writeFile | public static void writeFile(String filename, String data) throws HeclException(Code) | | The writeFile method writes the 'data' String to
the file given by 'filename'.
Parameters: filename - a String value Parameters: data - a String value exception: HeclException - if an error occurs |
|
|