All Packages Class Hierarchy This Package Previous Next Index
Class mesquite.lib.MesquiteFile
mesquite.lib.Listened
|
+----mesquite.lib.MesquiteFile
- public class MesquiteFile
- extends mesquite.lib.Listened
- implements mesquite.lib.HNode, mesquite.lib.Commandable, mesquite.lib.Listable, mesquite.lib.Explainable
This MesquiteFile is the file on disk, not the project.
-
appendToLog
-
-
fileSeparator
-
-
foreignElements
-
-
QUERY_CLOSE
-
-
QUERY_DELETE
-
-
QUERY_NONE
-
-
QUERY_QUIT
-
-
totalCreated
-
-
totalDisposed
-
-
totalFinalized
-
-
useDataBlock
-
-
MesquiteFile()
-
-
addFileElement(FileElement)
- Adds the passed FileElement to the file.
-
appendFileContents(String, String, boolean)
- Appends to a file the contents.
-
canWrite(String)
- Checks to see if can write to a file
-
changeLocation(String)
- for use by save as; user puts file.
-
changeLocation(String, String)
- redirects place at which file will be rewritten; for use by save as
-
checkFilePath(String, String)
- Checks to see if path leads to a file; if so, path returned; if not, user is asked to choose new file.
-
chooseDirectory(String)
- To choose a directory; returns path
-
close()
- Closes the file and removes from the project all file elements belonging to it.
-
closeAndDelete()
- Closes the file, removes from the project all file elements belonging to it, and deletes it.
-
closeLog()
- Closes to the log file
-
closeReading()
- Closes the file for reading.
-
closeWriting()
- Close file for writing
-
composePath(String, String)
- Return string for path, accommodating ../ at start of filename.
-
decomposePath(String, String)
- Converts absolute to relative string for path
-
deleteFile(String)
- deletes file at path
-
doCommand(String, String, CommandRecord, CommandChecker)
- The method by which commands are sent to the file using text-based scripting.
-
existingLength()
- Returns size of existing file on disk corresponding to this MesquiteFile
-
fileExists(String)
- Checks to see if path leads to a file that is not a directory
-
finalize()
-
-
firstToken(StringBuffer)
- Returns next token from file.
-
getAnnotation()
- Returns the annotation (e.g., footnote) of this element
-
getBeingSaved()
-
-
getCloseAfterReading()
-
-
getDirectoryName()
- Get directory in which file resides (actually, entire path)
-
getExplanation()
- Returns the explanation (e.g., footnote plus additional information) of this file
-
getFileAborted()
- Returns true if user has requested file reading or writing stop.
-
getFileContentsAsString(int)
- Returns the contents of the file, local or remote.
-
getFileContentsAsString(String)
- Returns the contents of the file.
-
getFileContentsAsString(String, int)
- Returns the contents of the file.
-
getFileContentsAsStrings(String)
- Returns the contents of the file.
-
getFileElements()
- Gets list of file elements.
-
getFileFirstContents(String)
- Returns the first line of the file.
-
getFileName()
- Get name of file.
-
getHColor()
-
-
getHDaughters()
-
-
getHImage()
-
-
getHMother()
-
-
getHShow()
-
-
getID()
-
-
getLogWriter()
-
-
getName()
-
-
getNextBlock(MesquiteString, StringBuffer, StringBuffer)
- returns the next block; blockName is passed back via the MesquiteString object
-
getNextCommand(MesquiteInteger, StringBuffer)
- returns the next command in the file.
-
getNumberOfFiles()
-
-
getNumSupplements()
-
-
getOpenAsUntitled()
-
-
getPath()
- Returns path to file on disk 19 Jan 02
-
getProject()
- gets the project to which the MesquiteFile belongs.
-
getSupplementName(int)
-
-
getTypeName()
-
-
getURL()
- Get URL of file (null if a local file).
-
getWriteProtected()
-
-
hNodeAction(Container, int, int, int)
- for HNode interface
-
hSupplementTouched(int)
-
-
isClosed()
-
-
isDirty()
-
-
isLocal()
- returns true if file is local (on disk), false if remote (via URL).
-
isWriting()
-
-
linkProgressIndicator(ProgressIndicator)
- Links progress indicator
-
massageFilePathToURL(String)
- converts an existing path to a URL string
-
newFile(String, String)
- if not applet, opens new file on disk with given name
-
nextToken(StringBuffer)
- Returns next token from file.
-
open(boolean, FilenameFilter, String, String)
- if not applet, allows user to choose, then opens existing file on disk
-
open(boolean, FilenameFilter, String, String, CommandRecord)
- if not applet, allows user to choose, then opens existing file on disk
-
open(boolean, String)
- opens existing file on disk or URL
-
open(boolean, String, String)
- opens existing file on disk or URL
-
open(boolean, String, String, String)
- opens existing file on disk or URL
-
open(boolean, String, String, String, CommandRecord)
- opens existing file on disk or URL
-
open(String, String)
- if not applet, opens existing file on disk with given name
-
open(URL)
- opens existing file at given URL
-
openFileDialog(String, MesquiteString, MesquiteString)
- for use by open; chooses file.
-
openReading()
- Opens the file for reading.
-
openWriting(boolean)
- Open file for writing.
-
putFileContents(String, String, boolean)
- Places to a file the contents.
-
putFileContents(String, String[], boolean)
- Places to a file the contents.
-
putFileContents(String, Vector, boolean)
- Places to a file the contents.
-
putFileContentsQuery(String, String, boolean)
-
-
readLine()
- read next line from file, return as String.
-
readLine(String)
- read next line from file, return as String.
-
readNextDarkLine()
- read next dark line from file, return as String.
-
removeFileElement(FileElement)
- Removes the passed FileElement from the file.
-
reportTimes()
- for development purposes; to time file reading //TODO: get rid of this in final
-
saveFileAsDialog(String)
- for use by save as; user puts file.
-
saveFileAsDialog(String, StringBuffer)
- for use by save as; user puts file.
-
setAnnotation(String, boolean)
- Sets the annotation (e.g., footnote) of this element
-
setBeingSaved(boolean)
-
-
setCloseAfterReading(boolean)
-
-
setDirtiedByCommand(boolean)
-
-
setIsNexus(boolean)
-
-
setLocs(boolean, URL, String, String)
- A low-level call to change various location parameters.
-
setOpenAsUntitled(String)
-
-
setPath(String)
- A low-level call to change fileName.
-
setProject(MesquiteProject)
- sets the project to which the MesquiteFile belongs.
-
setWriteProtected(boolean)
-
-
toString()
-
-
write(String)
- Write string to file
-
writeLine(String)
- Write string to file and add newline character.
-
writeToLog(String)
- Writes to the log file
QUERY_NONE
public static final int QUERY_NONE
QUERY_CLOSE
public static final int QUERY_CLOSE
QUERY_DELETE
public static final int QUERY_DELETE
QUERY_QUIT
public static final int QUERY_QUIT
totalCreated
public static int totalCreated
totalDisposed
public static int totalDisposed
totalFinalized
public static int totalFinalized
foreignElements
public java.util.Vector foreignElements
useDataBlock
public boolean useDataBlock
fileSeparator
public static java.lang.String fileSeparator
appendToLog
public static boolean appendToLog
MesquiteFile
public MesquiteFile()
getID
public long getID()
finalize
public void finalize() throws java.lang.Throwable
getNumberOfFiles
public static int getNumberOfFiles()
getOpenAsUntitled
public java.lang.String getOpenAsUntitled()
setOpenAsUntitled
public void setOpenAsUntitled(java.lang.String reason)
getCloseAfterReading
public boolean getCloseAfterReading()
setCloseAfterReading
public void setCloseAfterReading(boolean c)
setBeingSaved
public void setBeingSaved(boolean s)
getBeingSaved
public boolean getBeingSaved()
setIsNexus
public void setIsNexus(boolean s)
isClosed
public boolean isClosed()
reportTimes
public void reportTimes()
- for development purposes; to time file reading //TODO: get rid of this in final
doCommand
public java.lang.Object doCommand(java.lang.String commandName,
java.lang.String arguments,
mesquite.lib.CommandRecord commandRec,
mesquite.lib.CommandChecker checker)
- The method by which commands are sent to the file using text-based scripting.
existingLength
public long existingLength()
- Returns size of existing file on disk corresponding to this MesquiteFile
toString
public java.lang.String toString()
newFile
public static mesquite.lib.MesquiteFile newFile(java.lang.String directoryName,
java.lang.String fileName)
- if not applet, opens new file on disk with given name
open
public static mesquite.lib.MesquiteFile open(boolean local,
java.io.FilenameFilter fileFilter,
java.lang.String message,
java.lang.String suggestedDirectory)
- if not applet, allows user to choose, then opens existing file on disk
open
public static mesquite.lib.MesquiteFile open(boolean local,
java.io.FilenameFilter fileFilter,
java.lang.String message,
java.lang.String suggestedDirectory,
mesquite.lib.CommandRecord commandRec)
- if not applet, allows user to choose, then opens existing file on disk
open
public static mesquite.lib.MesquiteFile open(boolean local,
java.lang.String location)
- opens existing file on disk or URL
open
public static mesquite.lib.MesquiteFile open(boolean local,
java.lang.String location,
java.lang.String suggestedDirectory)
- opens existing file on disk or URL
open
public static mesquite.lib.MesquiteFile open(boolean local,
java.lang.String location,
java.lang.String message,
java.lang.String suggestedDirectory)
- opens existing file on disk or URL
open
public static mesquite.lib.MesquiteFile open(boolean local,
java.lang.String location,
java.lang.String message,
java.lang.String suggestedDirectory,
mesquite.lib.CommandRecord commandRec)
- opens existing file on disk or URL
open
public static mesquite.lib.MesquiteFile open(java.lang.String directoryName,
java.lang.String fileName)
- if not applet, opens existing file on disk with given name
open
public static mesquite.lib.MesquiteFile open(java.net.URL url)
- opens existing file at given URL
isDirty
public boolean isDirty()
close
public boolean close()
- Closes the file and removes from the project all file elements belonging to it.
setDirtiedByCommand
public void setDirtiedByCommand(boolean dirtied)
closeAndDelete
public boolean closeAndDelete()
- Closes the file, removes from the project all file elements belonging to it, and deletes it.
setLocs
public void setLocs(boolean local,
java.net.URL url,
java.lang.String f,
java.lang.String d)
- A low-level call to change various location parameters. Shouldn't be used too liberally; changeLocation does more housekeeping.
setPath
public void setPath(java.lang.String path)
- A low-level call to change fileName. Shouldn't be used too liberally; changeLocation does more housekeeping.
getPath
public java.lang.String getPath()
- Returns path to file on disk 19 Jan 02
changeLocation
public void changeLocation(java.lang.String directoryName,
java.lang.String fileName)
- redirects place at which file will be rewritten; for use by save as
changeLocation
public boolean changeLocation(java.lang.String message)
- for use by save as; user puts file. Returns true if new location successfuly found
saveFileAsDialog
public static java.lang.String saveFileAsDialog(java.lang.String message)
- for use by save as; user puts file. Returns new location
saveFileAsDialog
public static java.lang.String saveFileAsDialog(java.lang.String message,
java.lang.StringBuffer fileNameBuffer)
- for use by save as; user puts file. Returns new location
chooseDirectory
public static java.lang.String chooseDirectory(java.lang.String message)
- To choose a directory; returns path
openFileDialog
public static java.lang.String openFileDialog(java.lang.String message,
mesquite.lib.MesquiteString directoryName,
mesquite.lib.MesquiteString fileName)
- for use by open; chooses file. Returns full path and also separate directory and file names in MesquiteStrings
isLocal
public boolean isLocal()
- returns true if file is local (on disk), false if remote (via URL).
setProject
public void setProject(mesquite.lib.MesquiteProject proj)
- sets the project to which the MesquiteFile belongs.
getProject
public mesquite.lib.MesquiteProject getProject()
- gets the project to which the MesquiteFile belongs.
openReading
public boolean openReading()
- Opens the file for reading.
closeReading
public void closeReading()
- Closes the file for reading.
openWriting
public boolean openWriting(boolean ascii)
- Open file for writing.
writeLine
public void writeLine(java.lang.String s)
- Write string to file and add newline character.
write
public void write(java.lang.String s)
- Write string to file
closeWriting
public void closeWriting()
- Close file for writing
isWriting
public boolean isWriting()
getDirectoryName
public java.lang.String getDirectoryName()
- Get directory in which file resides (actually, entire path)
getFileName
public java.lang.String getFileName()
- Get name of file.
getURL
public java.net.URL getURL()
- Get URL of file (null if a local file).
composePath
public static java.lang.String composePath(java.lang.String d,
java.lang.String f)
- Return string for path, accommodating ../ at start of filename. If second string passed begins with "/", this
assumes that the string is an entire path to a local volume (e.g. "/HardDrive/MyDirectory/picture.gif") and ignores
the first string. In some cases, d is directory; f is file
decomposePath
public static java.lang.String decomposePath(java.lang.String relativeTo,
java.lang.String path)
- Converts absolute to relative string for path
massageFilePathToURL
public static java.lang.String massageFilePathToURL(java.lang.String path)
- converts an existing path to a URL string
linkProgressIndicator
public void linkProgressIndicator(mesquite.lib.ProgressIndicator pi)
- Links progress indicator
getFileAborted
public boolean getFileAborted()
- Returns true if user has requested file reading or writing stop.
readLine
public java.lang.String readLine(java.lang.String endLine)
- read next line from file, return as String.
readLine
public java.lang.String readLine()
- read next line from file, return as String.
readNextDarkLine
public java.lang.String readNextDarkLine()
- read next dark line from file, return as String.
nextToken
public java.lang.String nextToken(java.lang.StringBuffer commentBuffer)
- Returns next token from file. Note that firstToken is used for the first token in a command
firstToken
public java.lang.String firstToken(java.lang.StringBuffer commentBuffer)
- Returns next token from file. Used for first token of command, to preserves leading whitespace (used to preserve
leading tabs/spaces for blocks such as the MesquiteBlock).
getNextBlock
public mesquite.lib.FileBlock getNextBlock(mesquite.lib.MesquiteString blockName,
java.lang.StringBuffer fileComments,
java.lang.StringBuffer blockComments)
- returns the next block; blockName is passed back via the MesquiteString object
getNextCommand
public java.lang.String getNextCommand(mesquite.lib.MesquiteInteger status,
java.lang.StringBuffer commandComments)
- returns the next command in the file. Extra information about the command is
returned in the MesquiteInteger status. If the command is the "begin", 1 is returned; if "end;", 2 is returned.
Otherwise 0 is returned.
addFileElement
public void addFileElement(mesquite.lib.FileElement element)
- Adds the passed FileElement to the file.
removeFileElement
public void removeFileElement(mesquite.lib.FileElement element)
- Removes the passed FileElement from the file.
getFileElements
public mesquite.lib.ListableVector getFileElements()
- Gets list of file elements.
deleteFile
public static boolean deleteFile(java.lang.String path)
- deletes file at path
fileExists
public static boolean fileExists(java.lang.String path)
- Checks to see if path leads to a file that is not a directory
canWrite
public static boolean canWrite(java.lang.String path)
- Checks to see if can write to a file
checkFilePath
public static java.lang.String checkFilePath(java.lang.String path,
java.lang.String selectMessage)
- Checks to see if path leads to a file; if so, path returned; if not, user is asked to choose new file.
getFileFirstContents
public static java.lang.String getFileFirstContents(java.lang.String relativePath)
- Returns the first line of the file. path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName"
getFileContentsAsStrings
public static java.lang.String[] getFileContentsAsStrings(java.lang.String relativePath)
- Returns the contents of the file. path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName"
getFileContentsAsString
public static java.lang.String getFileContentsAsString(java.lang.String relativePath)
- Returns the contents of the file. path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName".
getFileContentsAsString
public java.lang.String getFileContentsAsString(int maxCharacters)
- Returns the contents of the file, local or remote. The parameter "maxCharacters"
sets an upper limit on how many characters are read (if <0, then all characters read in)
getFileContentsAsString
public static java.lang.String getFileContentsAsString(java.lang.String relativePath,
int maxCharacters)
- Returns the contents of the file. path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName". The parameter "maxCharacters"
sets an upper limit on how many characters are read (if <0, then all characters read in)
putFileContentsQuery
public static void putFileContentsQuery(java.lang.String message,
java.lang.String output,
boolean ascii)
putFileContents
public static synchronized void putFileContents(java.lang.String relativePath,
java.lang.String contents[],
boolean ascii)
- Places to a file the contents. Path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName"
putFileContents
public static synchronized void putFileContents(java.lang.String relativePath,
java.util.Vector contents,
boolean ascii)
- Places to a file the contents. Path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName"
putFileContents
public static synchronized void putFileContents(java.lang.String relativePath,
java.lang.String contents,
boolean ascii)
- Places to a file the contents. Path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName"
appendFileContents
public static synchronized void appendFileContents(java.lang.String relativePath,
java.lang.String contents,
boolean ascii)
- Appends to a file the contents. Path is relative to the root of the package heirarchy; i.e. for file in
a module's folder, indicate "mesquite/modules/moduleFolderName/fileName"
writeToLog
public static void writeToLog(java.lang.String s)
- Writes to the log file
getLogWriter
public static java.io.PrintWriter getLogWriter()
closeLog
public static void closeLog()
- Closes to the log file
getWriteProtected
public boolean getWriteProtected()
setWriteProtected
public void setWriteProtected(boolean prot)
setAnnotation
public void setAnnotation(java.lang.String e,
boolean notify)
- Sets the annotation (e.g., footnote) of this element
getAnnotation
public java.lang.String getAnnotation()
- Returns the annotation (e.g., footnote) of this element
getExplanation
public java.lang.String getExplanation()
- Returns the explanation (e.g., footnote plus additional information) of this file
getHDaughters
public mesquite.lib.HNode[] getHDaughters()
getHMother
public mesquite.lib.HNode getHMother()
getName
public java.lang.String getName()
getTypeName
public java.lang.String getTypeName()
getNumSupplements
public int getNumSupplements()
getSupplementName
public java.lang.String getSupplementName(int index)
hNodeAction
public void hNodeAction(java.awt.Container c,
int x,
int y,
int action)
- for HNode interface
hSupplementTouched
public void hSupplementTouched(int index)
getHImage
public java.awt.Image getHImage()
getHColor
public java.awt.Color getHColor()
getHShow
public boolean getHShow()
All Packages Class Hierarchy This Package Previous Next Index