|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hecl.files.HeclFile
public class HeclFile
HeclFile
implements all the filesystem interaction
methods. It's not used in J2ME code, so we can add all we like
here.
Field Summary | |
---|---|
static java.lang.String |
currentFile
|
Constructor Summary | |
---|---|
HeclFile()
|
Method Summary | |
---|---|
static void |
changeDir(java.lang.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. |
static java.util.Vector |
fileToList(java.lang.String filename)
fileToList splits a path like /a/b/c into the list
{/ a b c} so that it's easy to manipulate programatically. |
static java.lang.String |
listToFile(java.util.Vector filenamelist)
listToFile takes a list like {a b c} and converts
it to a filename such as a/b/c. |
void |
loadModule(Interp interp)
The loadModule method usually takes care of
creating commands that are present in this module. |
static java.lang.StringBuffer |
readFile(java.lang.String filename)
readFile reads in a text file, given a filename,
and returns its contents as a StringBuffer. |
static void |
sourceFile(Interp interp,
java.lang.String filename)
The sourceFile method is the equivalent of the
"source" command. |
void |
unloadModule(Interp interp)
The unloadModule method takes care of any clean up
that's necessary, such as unloading commands created by this
module. |
static void |
writeFile(java.lang.String filename,
java.lang.String data)
The writeFile method writes the 'data' String to
the file given by 'filename'. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String currentFile
Constructor Detail |
---|
public HeclFile()
Method Detail |
---|
public static void changeDir(java.lang.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.
dirname
- a String
valuepublic static java.lang.StringBuffer readFile(java.lang.String filename) throws HeclException
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.
filename
- a String
value
StringBuffer
value
HeclException
- if an error occurspublic static void writeFile(java.lang.String filename, java.lang.String data) throws HeclException
writeFile
method writes the 'data' String to
the file given by 'filename'.
filename
- a String
valuedata
- a String
value
HeclException
- if an error occurspublic static java.lang.String listToFile(java.util.Vector filenamelist)
listToFile
takes a list like {a b c} and converts
it to a filename such as a/b/c.
filenamelist
- a Vector
value
String
valuepublic static java.util.Vector fileToList(java.lang.String filename)
fileToList
splits a path like /a/b/c into the list
{/ a b c} so that it's easy to manipulate programatically.
filename
- a String
value
Vector
valuepublic static void sourceFile(Interp interp, java.lang.String filename) throws HeclException
sourceFile
method is the equivalent of the
"source" command.
interp
- an Interp
valuefilename
- a String
value
HeclException
- if an error occurspublic void loadModule(Interp interp) throws HeclException
HeclModule
loadModule
method usually takes care of
creating commands that are present in this module.
loadModule
in interface HeclModule
interp
- an Interp
value
HeclException
- if an error occurspublic void unloadModule(Interp interp) throws HeclException
HeclModule
unloadModule
method takes care of any clean up
that's necessary, such as unloading commands created by this
module.
unloadModule
in interface HeclModule
interp
- an Interp
value
HeclException
- if an error occurs
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |