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.


Variable Index

 o appendToLog
 o fileSeparator
 o foreignElements
 o QUERY_CLOSE
 o QUERY_DELETE
 o QUERY_NONE
 o QUERY_QUIT
 o totalCreated
 o totalDisposed
 o totalFinalized
 o useDataBlock

Constructor Index

 o MesquiteFile()

Method Index

 o addFileElement(FileElement)
Adds the passed FileElement to the file.
 o appendFileContents(String, String, boolean)
Appends to a file the contents.
 o canWrite(String)
Checks to see if can write to a file
 o changeLocation(String)
for use by save as; user puts file.
 o changeLocation(String, String)
redirects place at which file will be rewritten; for use by save as
 o 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.
 o chooseDirectory(String)
To choose a directory; returns path
 o close()
Closes the file and removes from the project all file elements belonging to it.
 o closeAndDelete()
Closes the file, removes from the project all file elements belonging to it, and deletes it.
 o closeLog()
Closes to the log file
 o closeReading()
Closes the file for reading.
 o closeWriting()
Close file for writing
 o composePath(String, String)
Return string for path, accommodating ../ at start of filename.
 o decomposePath(String, String)
Converts absolute to relative string for path
 o deleteFile(String)
deletes file at path
 o doCommand(String, String, CommandRecord, CommandChecker)
The method by which commands are sent to the file using text-based scripting.
 o existingLength()
Returns size of existing file on disk corresponding to this MesquiteFile
 o fileExists(String)
Checks to see if path leads to a file that is not a directory
 o finalize()
 o firstToken(StringBuffer)
Returns next token from file.
 o getAnnotation()
Returns the annotation (e.g., footnote) of this element
 o getBeingSaved()
 o getCloseAfterReading()
 o getDirectoryName()
Get directory in which file resides (actually, entire path)
 o getExplanation()
Returns the explanation (e.g., footnote plus additional information) of this file
 o getFileAborted()
Returns true if user has requested file reading or writing stop.
 o getFileContentsAsString(int)
Returns the contents of the file, local or remote.
 o getFileContentsAsString(String)
Returns the contents of the file.
 o getFileContentsAsString(String, int)
Returns the contents of the file.
 o getFileContentsAsStrings(String)
Returns the contents of the file.
 o getFileElements()
Gets list of file elements.
 o getFileFirstContents(String)
Returns the first line of the file.
 o getFileName()
Get name of file.
 o getHColor()
 o getHDaughters()
 o getHImage()
 o getHMother()
 o getHShow()
 o getID()
 o getLogWriter()
 o getName()
 o getNextBlock(MesquiteString, StringBuffer, StringBuffer)
returns the next block; blockName is passed back via the MesquiteString object
 o getNextCommand(MesquiteInteger, StringBuffer)
returns the next command in the file.
 o getNumberOfFiles()
 o getNumSupplements()
 o getOpenAsUntitled()
 o getPath()
Returns path to file on disk 19 Jan 02
 o getProject()
gets the project to which the MesquiteFile belongs.
 o getSupplementName(int)
 o getTypeName()
 o getURL()
Get URL of file (null if a local file).
 o getWriteProtected()
 o hNodeAction(Container, int, int, int)
for HNode interface
 o hSupplementTouched(int)
 o isClosed()
 o isDirty()
 o isLocal()
returns true if file is local (on disk), false if remote (via URL).
 o isWriting()
 o linkProgressIndicator(ProgressIndicator)
Links progress indicator
 o massageFilePathToURL(String)
converts an existing path to a URL string
 o newFile(String, String)
if not applet, opens new file on disk with given name
 o nextToken(StringBuffer)
Returns next token from file.
 o open(boolean, FilenameFilter, String, String)
if not applet, allows user to choose, then opens existing file on disk
 o open(boolean, FilenameFilter, String, String, CommandRecord)
if not applet, allows user to choose, then opens existing file on disk
 o open(boolean, String)
opens existing file on disk or URL
 o open(boolean, String, String)
opens existing file on disk or URL
 o open(boolean, String, String, String)
opens existing file on disk or URL
 o open(boolean, String, String, String, CommandRecord)
opens existing file on disk or URL
 o open(String, String)
if not applet, opens existing file on disk with given name
 o open(URL)
opens existing file at given URL
 o openFileDialog(String, MesquiteString, MesquiteString)
for use by open; chooses file.
 o openReading()
Opens the file for reading.
 o openWriting(boolean)
Open file for writing.
 o putFileContents(String, String, boolean)
Places to a file the contents.
 o putFileContents(String, String[], boolean)
Places to a file the contents.
 o putFileContents(String, Vector, boolean)
Places to a file the contents.
 o putFileContentsQuery(String, String, boolean)
 o readLine()
read next line from file, return as String.
 o readLine(String)
read next line from file, return as String.
 o readNextDarkLine()
read next dark line from file, return as String.
 o removeFileElement(FileElement)
Removes the passed FileElement from the file.
 o reportTimes()
for development purposes; to time file reading //TODO: get rid of this in final
 o saveFileAsDialog(String)
for use by save as; user puts file.
 o saveFileAsDialog(String, StringBuffer)
for use by save as; user puts file.
 o setAnnotation(String, boolean)
Sets the annotation (e.g., footnote) of this element
 o setBeingSaved(boolean)
 o setCloseAfterReading(boolean)
 o setDirtiedByCommand(boolean)
 o setIsNexus(boolean)
 o setLocs(boolean, URL, String, String)
A low-level call to change various location parameters.
 o setOpenAsUntitled(String)
 o setPath(String)
A low-level call to change fileName.
 o setProject(MesquiteProject)
sets the project to which the MesquiteFile belongs.
 o setWriteProtected(boolean)
 o toString()
 o write(String)
Write string to file
 o writeLine(String)
Write string to file and add newline character.
 o writeToLog(String)
Writes to the log file

Variables

 o QUERY_NONE
 public static final int QUERY_NONE
 o QUERY_CLOSE
 public static final int QUERY_CLOSE
 o QUERY_DELETE
 public static final int QUERY_DELETE
 o QUERY_QUIT
 public static final int QUERY_QUIT
 o totalCreated
 public static int totalCreated
 o totalDisposed
 public static int totalDisposed
 o totalFinalized
 public static int totalFinalized
 o foreignElements
 public java.util.Vector foreignElements
 o useDataBlock
 public boolean useDataBlock
 o fileSeparator
 public static java.lang.String fileSeparator
 o appendToLog
 public static boolean appendToLog

Constructors

 o MesquiteFile
 public MesquiteFile()

Methods

 o getID
 public long getID()
 o finalize
 public void finalize() throws java.lang.Throwable
 o getNumberOfFiles
 public static int getNumberOfFiles()
 o getOpenAsUntitled
 public java.lang.String getOpenAsUntitled()
 o setOpenAsUntitled
 public void setOpenAsUntitled(java.lang.String reason)
 o getCloseAfterReading
 public boolean getCloseAfterReading()
 o setCloseAfterReading
 public void setCloseAfterReading(boolean c)
 o setBeingSaved
 public void setBeingSaved(boolean s)
 o getBeingSaved
 public boolean getBeingSaved()
 o setIsNexus
 public void setIsNexus(boolean s)
 o isClosed
 public boolean isClosed()
 o reportTimes
 public void reportTimes()
for development purposes; to time file reading //TODO: get rid of this in final

 o 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.

 o existingLength
 public long existingLength()
Returns size of existing file on disk corresponding to this MesquiteFile

 o toString
 public java.lang.String toString()
 o 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

 o 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

 o 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

 o open
 public static mesquite.lib.MesquiteFile open(boolean local,
                                              java.lang.String location)
opens existing file on disk or URL

 o open
 public static mesquite.lib.MesquiteFile open(boolean local,
                                              java.lang.String location,
                                              java.lang.String suggestedDirectory)
opens existing file on disk or URL

 o 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

 o 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

 o 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

 o open
 public static mesquite.lib.MesquiteFile open(java.net.URL url)
opens existing file at given URL

 o isDirty
 public boolean isDirty()
 o close
 public boolean close()
Closes the file and removes from the project all file elements belonging to it.

 o setDirtiedByCommand
 public void setDirtiedByCommand(boolean dirtied)
 o closeAndDelete
 public boolean closeAndDelete()
Closes the file, removes from the project all file elements belonging to it, and deletes it.

 o 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.

 o 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.

 o getPath
 public java.lang.String getPath()
Returns path to file on disk 19 Jan 02

 o 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

 o changeLocation
 public boolean changeLocation(java.lang.String message)
for use by save as; user puts file. Returns true if new location successfuly found

 o saveFileAsDialog
 public static java.lang.String saveFileAsDialog(java.lang.String message)
for use by save as; user puts file. Returns new location

 o 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

 o chooseDirectory
 public static java.lang.String chooseDirectory(java.lang.String message)
To choose a directory; returns path

 o 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

 o isLocal
 public boolean isLocal()
returns true if file is local (on disk), false if remote (via URL).

 o setProject
 public void setProject(mesquite.lib.MesquiteProject proj)
sets the project to which the MesquiteFile belongs.

 o getProject
 public mesquite.lib.MesquiteProject getProject()
gets the project to which the MesquiteFile belongs.

 o openReading
 public boolean openReading()
Opens the file for reading.

 o closeReading
 public void closeReading()
Closes the file for reading.

 o openWriting
 public boolean openWriting(boolean ascii)
Open file for writing.

 o writeLine
 public void writeLine(java.lang.String s)
Write string to file and add newline character.

 o write
 public void write(java.lang.String s)
Write string to file

 o closeWriting
 public void closeWriting()
Close file for writing

 o isWriting
 public boolean isWriting()
 o getDirectoryName
 public java.lang.String getDirectoryName()
Get directory in which file resides (actually, entire path)

 o getFileName
 public java.lang.String getFileName()
Get name of file.

 o getURL
 public java.net.URL getURL()
Get URL of file (null if a local file).

 o 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

 o decomposePath
 public static java.lang.String decomposePath(java.lang.String relativeTo,
                                              java.lang.String path)
Converts absolute to relative string for path

 o massageFilePathToURL
 public static java.lang.String massageFilePathToURL(java.lang.String path)
converts an existing path to a URL string

 o linkProgressIndicator
 public void linkProgressIndicator(mesquite.lib.ProgressIndicator pi)
Links progress indicator

 o getFileAborted
 public boolean getFileAborted()
Returns true if user has requested file reading or writing stop.

 o readLine
 public java.lang.String readLine(java.lang.String endLine)
read next line from file, return as String.

 o readLine
 public java.lang.String readLine()
read next line from file, return as String.

 o readNextDarkLine
 public java.lang.String readNextDarkLine()
read next dark line from file, return as String.

 o 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

 o 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).

 o 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

 o 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.

 o addFileElement
 public void addFileElement(mesquite.lib.FileElement element)
Adds the passed FileElement to the file.

 o removeFileElement
 public void removeFileElement(mesquite.lib.FileElement element)
Removes the passed FileElement from the file.

 o getFileElements
 public mesquite.lib.ListableVector getFileElements()
Gets list of file elements.

 o deleteFile
 public static boolean deleteFile(java.lang.String path)
deletes file at path

 o fileExists
 public static boolean fileExists(java.lang.String path)
Checks to see if path leads to a file that is not a directory

 o canWrite
 public static boolean canWrite(java.lang.String path)
Checks to see if can write to a file

 o 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.

 o 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"

 o 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"

 o 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".

 o 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)

 o 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)

 o putFileContentsQuery
 public static void putFileContentsQuery(java.lang.String message,
                                         java.lang.String output,
                                         boolean ascii)
 o 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"

 o 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"

 o 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"

 o 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"

 o writeToLog
 public static void writeToLog(java.lang.String s)
Writes to the log file

 o getLogWriter
 public static java.io.PrintWriter getLogWriter()
 o closeLog
 public static void closeLog()
Closes to the log file

 o getWriteProtected
 public boolean getWriteProtected()
 o setWriteProtected
 public void setWriteProtected(boolean prot)
 o setAnnotation
 public void setAnnotation(java.lang.String e,
                           boolean notify)
Sets the annotation (e.g., footnote) of this element

 o getAnnotation
 public java.lang.String getAnnotation()
Returns the annotation (e.g., footnote) of this element

 o getExplanation
 public java.lang.String getExplanation()
Returns the explanation (e.g., footnote plus additional information) of this file

 o getHDaughters
 public mesquite.lib.HNode[] getHDaughters()
 o getHMother
 public mesquite.lib.HNode getHMother()
 o getName
 public java.lang.String getName()
 o getTypeName
 public java.lang.String getTypeName()
 o getNumSupplements
 public int getNumSupplements()
 o getSupplementName
 public java.lang.String getSupplementName(int index)
 o hNodeAction
 public void hNodeAction(java.awt.Container c,
                         int x,
                         int y,
                         int action)
for HNode interface

 o hSupplementTouched
 public void hSupplementTouched(int index)
 o getHImage
 public java.awt.Image getHImage()
 o getHColor
 public java.awt.Color getHColor()
 o getHShow
 public boolean getHShow()

All Packages  Class Hierarchy  This Package  Previous  Next  Index