mesquite.lib
Class MesquiteFile

java.lang.Object
  extended by mesquite.lib.Listened
      extended by mesquite.lib.MesquiteFile
All Implemented Interfaces:
Commandable, Explainable, HNode, Listable, Listenable

public class MesquiteFile
extends Listened
implements HNode, Commandable, Listable, Explainable

This MesquiteFile is the file on disk, not the project.


Field Summary
 boolean ambiguityToMissing
           
static boolean appendToLog
           
 int exporting
           
static java.lang.String fileSeparator
           
 java.util.Vector foreignElements
           
static int HOME
           
static int INCLUDED
           
 boolean interleaveAllowed
           
static int LINKED
           
 java.util.Vector notesBugVector
           
 boolean notesBugWarn
           
static int QUERY_CLOSE
           
static int QUERY_DELETE
           
static int QUERY_NONE
           
static int QUERY_QUIT
           
 boolean simplifyNames
           
static int totalCreated
           
static int totalDisposed
           
static int totalFinalized
           
 boolean useDataBlocks
           
 boolean useSimplifiedNexus
           
 boolean writeExcludedCharacters
           
 
Fields inherited from class mesquite.lib.Listened
allListeners, classes, classesNotified, listeners, listenersRemaining, notifications
 
Fields inherited from interface mesquite.lib.HNode
MOUSEDOWN, MOUSEEXIT, MOUSEMOVE
 
Constructor Summary
MesquiteFile()
           
 
Method Summary
 void addFileElement(FileElement element)
          Adds the passed FileElement to the file.
static void appendFileContents(java.lang.String relativePath, java.lang.String contents, boolean ascii)
          Appends to a file the contents.
static boolean canWrite(java.lang.String path)
          Checks to see if can write to a file
 boolean changeLocation(java.lang.String message)
          for use by save as; user puts file.
 void changeLocation(java.lang.String directoryName, java.lang.String fileName)
          redirects place at which file will be rewritten; for use by save as
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.
static java.lang.String chooseDirectory(java.lang.String message)
          To choose a directory; returns path
static java.lang.String chooseDirectory(java.lang.String message, java.lang.String suggestedDir)
          To choose a directory; returns path
 boolean close()
          Closes the file and removes from the project all file elements belonging to it.
 boolean closeAndDelete()
          Closes the file, removes from the project all file elements belonging to it, and deletes it.
static void closeLog()
          Closes to the log file
 void closeReading()
          Closes the file for reading.
 void closeWriting()
          Close file for writing
 void closeWriting(int numBackups)
          Close file for writing
static java.lang.String composePath(java.lang.String d, java.lang.String f)
          Return string for path, accommodating ../ at start of filename.
static void copy(java.io.File src, java.io.File dst)
          A basic method for copying one File to another; if the destination file does not exist, it will be created
static java.lang.String decomposePath(java.lang.String relativeTo, java.lang.String path)
          Converts absolute to relative string for path
static boolean deleteDirectory(java.lang.String directoryPath)
           
static boolean deleteFile(java.lang.String path)
          deletes file at path
 java.lang.Object doCommand(java.lang.String commandName, java.lang.String arguments, CommandChecker checker)
          The method by which commands are sent to the file using text-based scripting.
static boolean downloadFTPorHTTPFile(java.lang.String urlString, java.lang.String localSaveDirectoryPath)
          Downloads the file present at the ftp URL urlString, saves the file into the local directory at localSaveDirectoryPath, using the file name given in the URL.
static boolean downloadFTPorHTTPFile(java.lang.String urlString, java.lang.String localSaveDirectoryPath, java.lang.String localSaveName)
          Downloads the file present at the ftp URL urlString, saves the file into the local directory at localSaveDirectoryPath, in the file localSaveName.
 long existingLength()
          Returns size of existing file on disk corresponding to this MesquiteFile
static boolean fileExists(java.lang.String path)
          Checks to see if path leads to a file that is not a directory
 void finalize()
           
 java.lang.String firstToken(java.lang.StringBuffer commentBuffer)
          Returns next token from file.
 java.lang.String getAnnotation()
          Returns the annotation (e.g., footnote) of this element
 boolean getBeingSaved()
           
 boolean getCloseAfterReading()
           
 CharacterData getCurrentData()
           
 Taxa getCurrentTaxa()
           
 java.lang.String getDirectoryName()
          Get directory in which file resides (actually, entire path)
static java.lang.String getDirectoryPathFromFilePath(java.lang.String path)
          Return string for directory path from full file path
 java.lang.String getExplanation()
          Returns the explanation (e.g., footnote plus additional information) of this file
 boolean getFileAborted()
          Returns true if user has requested file reading or writing stop.
 java.lang.String getFileContentsAsString(int maxCharacters)
          Returns the contents of the file, local or remote.
static java.lang.String getFileContentsAsString(java.lang.String relativePath)
          Returns the contents of the file.
static java.lang.String getFileContentsAsString(java.lang.String relativePath, int maxCharacters)
          Returns the contents of the file.
static java.lang.String getFileContentsAsString(java.lang.String relativePath, int maxCharacters, int startBufferSize)
          Returns the contents of the file.
static java.lang.String getFileContentsAsString(java.lang.String relativePath, int maxCharacters, int startBufferSize, boolean warnIfProblem)
          Returns the contents of the file.
static java.lang.String getFileContentsAsStringOld(java.lang.String relativePath, int maxCharacters, int startBufferSize)
          Returns the contents of the file.
static java.lang.String[] getFileContentsAsStrings(java.lang.String relativePath)
          Returns the contents of the file.
 ListableVector getFileElements()
          Gets list of file elements.
static java.lang.String getFileFirstContents(java.lang.String relativePath)
          Returns the first line of the file.
 java.lang.String getFileName()
          Get name of file.
static java.lang.String getFileNameFromFilePath(java.lang.String path)
          Return string for directory path from full file path
 long getFilePosition()
           
 java.awt.Color getHColor()
           
 HNode[] getHDaughters()
           
 java.awt.Image getHImage()
           
 HNode getHMother()
           
 boolean getHShow()
           
 long getID()
           
static java.io.PrintWriter getLogWriter()
           
 java.lang.String getName()
           
 FileBlock getNextBlock(MesquiteString blockName, java.lang.StringBuffer fileComments, java.lang.StringBuffer blockComments)
          returns the next block; blockName is passed back via the MesquiteString object
 FileBlock getNextBlockOLD(MesquiteString blockName, java.lang.StringBuffer fileComments, java.lang.StringBuffer blockComments)
          returns the next block; blockName is passed back via the MesquiteString object
 java.lang.String getNextCommand(MesquiteInteger status, java.lang.StringBuffer commandComments)
          returns the next command in the file.
 java.lang.String getNextCommand(MesquiteInteger status, java.lang.StringBuffer commandComments, boolean includeEntireCommand)
          returns the next command in the file.
static int getNumberOfFiles()
           
 int getNumSupplements()
           
 java.lang.String getOpenAsUntitled()
           
 java.lang.String getPath()
          Returns path to file on disk 19 Jan 02
 Author getPreviousSaver()
           
 MesquiteProject getProject()
          gets the project to which the MesquiteFile belongs.
 int getReadCategory()
           
 java.lang.String getSupplementName(int index)
           
static java.lang.String[][] getTabDelimitedTextFile(java.lang.String relativePath)
          Returns the contents of the file.
 java.lang.String getTypeName()
           
 java.net.URL getURL()
          Get URL of file (null if a local file).
static java.lang.String getURLContentsAsString(java.lang.String path, int maxCharacters)
          Returns the contents of the file at the url
static java.lang.String getURLContentsAsString(java.lang.String path, int maxCharacters, boolean warnIfProblem)
          Returns the contents of the file at the url
static java.lang.String[] getURLContentsAsStrings(java.lang.String path)
          Returns the contents of the file.
 boolean getWriteProtected()
           
 void goToFilePosition(long pos)
           
 java.lang.String goToNextBlockStart(MesquiteLong startPos)
          returns the file position of the start of the next block; returns blockName
 void hNodeAction(java.awt.Container c, int x, int y, int action)
          for HNode interface
 void hSupplementTouched(int index)
           
 boolean isClosed()
           
 boolean isDirty()
           
 boolean isLocal()
          returns true if file is local (on disk), false if remote (via URL).
 boolean isWriting()
           
 void linkProgressIndicator(ProgressIndicator pi)
          Links progress indicator
static java.lang.String massageFilePathToURL(java.lang.String path)
          converts an existing local file path to a URL string.
static java.lang.String massageStringToFilePathSafe(java.lang.String path)
          converts an existing local file path to a URL string.
static MesquiteFile newFile(java.lang.String directoryName, java.lang.String fileName)
          if not applet, opens new file on disk with given name
 java.lang.String nextToken(java.lang.StringBuffer commentBuffer)
          Returns next token from file.
static 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
static MesquiteFile open(boolean local, java.lang.String location)
          opens existing file on disk or URL
static MesquiteFile open(boolean local, java.lang.String location, java.lang.String suggestedDirectory)
          opens existing file on disk or URL
static MesquiteFile open(boolean local, java.lang.String location, java.lang.String message, java.lang.String suggestedDirectory)
          opens existing file on disk or URL
static MesquiteFile open(java.lang.String directoryName, java.lang.String fileName)
          if not applet, opens existing file on disk with given name
static MesquiteFile open(java.net.URL url)
          opens existing file at given URL
static java.lang.String openFileDialog(java.lang.String message, MesquiteString directoryName, MesquiteString fileName)
          for use by open; chooses file.
 boolean openReading()
          Opens the file for reading.
 boolean openWriting(boolean ascii)
          Open file for writing.
static void putFileContents(java.lang.String relativePath, java.lang.String[] contents, boolean ascii)
          Places to a file the contents.
static void putFileContents(java.lang.String relativePath, java.lang.String contents, boolean ascii)
          Places to a file the contents.
static void putFileContents(java.lang.String relativePath, java.util.Vector contents, boolean ascii)
          Places to a file the contents.
static void putFileContentsQuery(java.lang.String message, java.lang.String output, boolean ascii)
           
 java.lang.String readLine()
          read next line from file, return as String.
static java.lang.String readLine(java.io.InputStream inStream, java.lang.StringBuffer sBuff, MesquiteInteger remnantChar)
          read next line from file, return as String.
 java.lang.String readLine(java.lang.String endLine)
          read next line from file, return as String.
 boolean readLine(java.lang.StringBuffer buffer)
          read next line from file, return as String.
 java.lang.String readNextDarkLine()
          read next dark line from file, return as String.
 void removeFileElement(FileElement element)
          Removes the passed FileElement from the file.
 void reportTimes()
          for development purposes; to time file reading //TODO: get rid of this in final
static java.lang.String saveFileAsDialog(java.lang.String message)
          for use by save as; user puts file.
static java.lang.String saveFileAsDialog(java.lang.String message, java.lang.StringBuffer fileNameBuffer)
          for use by save as; user puts file.
 void setAnnotation(java.lang.String e, boolean notify)
          Sets the annotation (e.g., footnote) of this element
 void setBeingSaved(boolean s)
           
 void setCloseAfterReading(boolean c)
           
 void setCurrentData(CharacterData d)
           
 void setCurrentTaxa(Taxa d)
           
 void setDirtiedByCommand(boolean dirtied)
           
 void setFileName(java.lang.String fileName)
           
 void setIsNexus(boolean s)
           
 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.
 void setOpenAsUntitled(java.lang.String reason)
           
 void setPath(java.lang.String path)
          A low-level call to change fileName.
 void setPreviousSaver(Author a)
           
 void setProject(MesquiteProject proj)
          sets the project to which the MesquiteFile belongs.
 void setReadCategory(int r)
           
 void setWriteProtected(boolean prot)
           
 void skipNextCommand(MesquiteInteger status)
          skips the next command in the file.
static void throwableToLog(java.lang.Object obj, java.lang.Throwable e)
           
 java.lang.String toString()
           
 void write(java.lang.String s)
          Write string to file
 void writeLine(java.lang.String s)
          Write string to file and add newline character.
static void writeToLog(java.lang.String s)
          Writes to the log file
 
Methods inherited from class mesquite.lib.Listened
addListener, addListenerHighPriority, amIListening, decrementNotifySuppress, dispose, doAfterNotify, getRemainingListeners, incrementNotifySuppress, listListeners, notifyDisposing, notifyListeners, notifyListeners, removeListener, reportListeners, setDumpNotified
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_NONE

public static final int QUERY_NONE
See Also:
Constant Field Values

QUERY_CLOSE

public static final int QUERY_CLOSE
See Also:
Constant Field Values

QUERY_DELETE

public static final int QUERY_DELETE
See Also:
Constant Field Values

QUERY_QUIT

public static final int QUERY_QUIT
See Also:
Constant Field Values

LINKED

public static final int LINKED
See Also:
Constant Field Values

INCLUDED

public static final int INCLUDED
See Also:
Constant Field Values

HOME

public static final int HOME
See Also:
Constant Field Values

totalCreated

public static int totalCreated

totalDisposed

public static int totalDisposed

totalFinalized

public static int totalFinalized

foreignElements

public java.util.Vector foreignElements

useDataBlocks

public boolean useDataBlocks

useSimplifiedNexus

public boolean useSimplifiedNexus

interleaveAllowed

public boolean interleaveAllowed

simplifyNames

public boolean simplifyNames

ambiguityToMissing

public boolean ambiguityToMissing

writeExcludedCharacters

public boolean writeExcludedCharacters

exporting

public int exporting

notesBugWarn

public boolean notesBugWarn

notesBugVector

public java.util.Vector notesBugVector

fileSeparator

public static java.lang.String fileSeparator

appendToLog

public static boolean appendToLog
Constructor Detail

MesquiteFile

public MesquiteFile()
Method Detail

getID

public long getID()

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

setReadCategory

public void setReadCategory(int r)

getReadCategory

public int getReadCategory()

setPreviousSaver

public void setPreviousSaver(Author a)

getPreviousSaver

public Author getPreviousSaver()

setCurrentData

public void setCurrentData(CharacterData d)

getCurrentData

public CharacterData getCurrentData()

setCurrentTaxa

public void setCurrentTaxa(Taxa d)

getCurrentTaxa

public Taxa getCurrentTaxa()

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,
                                  CommandChecker checker)
The method by which commands are sent to the file using text-based scripting.

Specified by:
doCommand in interface Commandable

existingLength

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


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

newFile

public static MesquiteFile newFile(java.lang.String directoryName,
                                   java.lang.String fileName)
if not applet, opens new file on disk with given name


copy

public static void copy(java.io.File src,
                        java.io.File dst)
                 throws java.io.IOException
A basic method for copying one File to another; if the destination file does not exist, it will be created

Throws:
java.io.IOException

open

public static 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 MesquiteFile open(boolean local,
                                java.lang.String location)
opens existing file on disk or URL


open

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


open

public static 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 MesquiteFile open(java.lang.String directoryName,
                                java.lang.String fileName)
if not applet, opens existing file on disk with given name


open

public static 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.


downloadFTPorHTTPFile

public static boolean downloadFTPorHTTPFile(java.lang.String urlString,
                                            java.lang.String localSaveDirectoryPath,
                                            java.lang.String localSaveName)
Downloads the file present at the ftp URL urlString, saves the file into the local directory at localSaveDirectoryPath, in the file localSaveName. If localSaveName is blank, then it saves the file name given in the URL.


downloadFTPorHTTPFile

public static boolean downloadFTPorHTTPFile(java.lang.String urlString,
                                            java.lang.String localSaveDirectoryPath)
Downloads the file present at the ftp URL urlString, saves the file into the local directory at localSaveDirectoryPath, using the file name given in the URL.


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


setFileName

public void setFileName(java.lang.String fileName)

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


chooseDirectory

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


openFileDialog

public static java.lang.String openFileDialog(java.lang.String message,
                                              MesquiteString directoryName,
                                              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(MesquiteProject proj)
sets the project to which the MesquiteFile belongs.


getProject

public 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


closeWriting

public void closeWriting(int numBackups)
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).


getDirectoryPathFromFilePath

public static java.lang.String getDirectoryPathFromFilePath(java.lang.String path)
Return string for directory path from full file path


getFileNameFromFilePath

public static java.lang.String getFileNameFromFilePath(java.lang.String path)
Return string for directory path from full file path


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


massageStringToFilePathSafe

public static java.lang.String massageStringToFilePathSafe(java.lang.String path)
converts an existing local file path to a URL string. See also StringUtil.encodeForURL


massageFilePathToURL

public static java.lang.String massageFilePathToURL(java.lang.String path)
converts an existing local file path to a URL string. See also StringUtil.encodeForURL


linkProgressIndicator

public void linkProgressIndicator(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 boolean readLine(java.lang.StringBuffer buffer)
read next line from file, return as String.


readLine

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


readLine

public static java.lang.String readLine(java.io.InputStream inStream,
                                        java.lang.StringBuffer sBuff,
                                        MesquiteInteger remnantChar)
read next line from file, return as String.


readNextDarkLine

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


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


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


getNextCommand

public java.lang.String getNextCommand(MesquiteInteger status,
                                       java.lang.StringBuffer commandComments,
                                       boolean includeEntireCommand)
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. If includeEntireCommand is true, then the entire command is returned; if false, the only the first token (command name) is returned. (Returning only part of the command can save time if the commands are long (e.g., a TREE) and not needed.


getNextCommand

public java.lang.String getNextCommand(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.


skipNextCommand

public void skipNextCommand(MesquiteInteger status)
skips the next command in the file. Extra information is returned in the MesquiteInteger status. If the command is the "begin", 1 is returned; if "end;", 2 is returned. Otherwise 0 is returned.


getNextBlockOLD

public FileBlock getNextBlockOLD(MesquiteString blockName,
                                 java.lang.StringBuffer fileComments,
                                 java.lang.StringBuffer blockComments)
returns the next block; blockName is passed back via the MesquiteString object


getNextBlock

public FileBlock getNextBlock(MesquiteString blockName,
                              java.lang.StringBuffer fileComments,
                              java.lang.StringBuffer blockComments)
returns the next block; blockName is passed back via the MesquiteString object


getFilePosition

public long getFilePosition()

goToFilePosition

public void goToFilePosition(long pos)

goToNextBlockStart

public java.lang.String goToNextBlockStart(MesquiteLong startPos)
returns the file position of the start of the next block; returns blockName


addFileElement

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


removeFileElement

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


getFileElements

public ListableVector getFileElements()
Gets list of file elements.


deleteFile

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


deleteDirectory

public static boolean deleteDirectory(java.lang.String directoryPath)

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"


getTabDelimitedTextFile

public static java.lang.String[][] getTabDelimitedTextFile(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)


getFileContentsAsString

public static java.lang.String getFileContentsAsString(java.lang.String relativePath,
                                                       int maxCharacters,
                                                       int startBufferSize)
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)


getFileContentsAsString

public static java.lang.String getFileContentsAsString(java.lang.String relativePath,
                                                       int maxCharacters,
                                                       int startBufferSize,
                                                       boolean warnIfProblem)
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)


getFileContentsAsStringOld

public static java.lang.String getFileContentsAsStringOld(java.lang.String relativePath,
                                                          int maxCharacters,
                                                          int startBufferSize)
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)


getURLContentsAsString

public static java.lang.String getURLContentsAsString(java.lang.String path,
                                                      int maxCharacters)
Returns the contents of the file at the url


getURLContentsAsString

public static java.lang.String getURLContentsAsString(java.lang.String path,
                                                      int maxCharacters,
                                                      boolean warnIfProblem)
Returns the contents of the file at the url


getURLContentsAsStrings

public static java.lang.String[] getURLContentsAsStrings(java.lang.String path)
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"


putFileContentsQuery

public static void putFileContentsQuery(java.lang.String message,
                                        java.lang.String output,
                                        boolean ascii)

putFileContents

public static 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 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 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 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()

throwableToLog

public static void throwableToLog(java.lang.Object obj,
                                  java.lang.Throwable e)

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

Specified by:
getExplanation in interface Explainable

getHDaughters

public HNode[] getHDaughters()
Specified by:
getHDaughters in interface HNode

getHMother

public HNode getHMother()
Specified by:
getHMother in interface HNode

getName

public java.lang.String getName()
Specified by:
getName in interface HNode
Specified by:
getName in interface Listable

getTypeName

public java.lang.String getTypeName()
Specified by:
getTypeName in interface HNode

getNumSupplements

public int getNumSupplements()
Specified by:
getNumSupplements in interface HNode

getSupplementName

public java.lang.String getSupplementName(int index)
Specified by:
getSupplementName in interface HNode

hNodeAction

public void hNodeAction(java.awt.Container c,
                        int x,
                        int y,
                        int action)
for HNode interface

Specified by:
hNodeAction in interface HNode

hSupplementTouched

public void hSupplementTouched(int index)
Specified by:
hSupplementTouched in interface HNode

getHImage

public java.awt.Image getHImage()
Specified by:
getHImage in interface HNode

getHColor

public java.awt.Color getHColor()
Specified by:
getHColor in interface HNode

getHShow

public boolean getHShow()
Specified by:
getHShow in interface HNode