|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmesquite.lib.Listened
mesquite.lib.MesquiteFile
public class MesquiteFile
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 |
|---|
public static final int QUERY_NONE
public static final int QUERY_CLOSE
public static final int QUERY_DELETE
public static final int QUERY_QUIT
public static final int LINKED
public static final int INCLUDED
public static final int HOME
public static int totalCreated
public static int totalDisposed
public static int totalFinalized
public java.util.Vector foreignElements
public boolean useDataBlocks
public boolean useSimplifiedNexus
public boolean interleaveAllowed
public boolean simplifyNames
public boolean ambiguityToMissing
public boolean writeExcludedCharacters
public int exporting
public boolean notesBugWarn
public java.util.Vector notesBugVector
public static java.lang.String fileSeparator
public static boolean appendToLog
| Constructor Detail |
|---|
public MesquiteFile()
| Method Detail |
|---|
public long getID()
public void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic void setReadCategory(int r)
public int getReadCategory()
public void setPreviousSaver(Author a)
public Author getPreviousSaver()
public void setCurrentData(CharacterData d)
public CharacterData getCurrentData()
public void setCurrentTaxa(Taxa d)
public Taxa getCurrentTaxa()
public static int getNumberOfFiles()
public java.lang.String getOpenAsUntitled()
public void setOpenAsUntitled(java.lang.String reason)
public boolean getCloseAfterReading()
public void setCloseAfterReading(boolean c)
public void setBeingSaved(boolean s)
public boolean getBeingSaved()
public void setIsNexus(boolean s)
public boolean isClosed()
public void reportTimes()
public java.lang.Object doCommand(java.lang.String commandName,
java.lang.String arguments,
CommandChecker checker)
doCommand in interface Commandablepublic long existingLength()
public java.lang.String toString()
toString in class java.lang.Object
public static MesquiteFile newFile(java.lang.String directoryName,
java.lang.String fileName)
public static void copy(java.io.File src,
java.io.File dst)
throws java.io.IOException
java.io.IOException
public static MesquiteFile open(boolean local,
java.io.FilenameFilter fileFilter,
java.lang.String message,
java.lang.String suggestedDirectory)
public static MesquiteFile open(boolean local,
java.lang.String location)
public static MesquiteFile open(boolean local,
java.lang.String location,
java.lang.String suggestedDirectory)
public static MesquiteFile open(boolean local,
java.lang.String location,
java.lang.String message,
java.lang.String suggestedDirectory)
public static MesquiteFile open(java.lang.String directoryName,
java.lang.String fileName)
public static MesquiteFile open(java.net.URL url)
public boolean isDirty()
public boolean close()
public void setDirtiedByCommand(boolean dirtied)
public boolean closeAndDelete()
public static boolean downloadFTPorHTTPFile(java.lang.String urlString,
java.lang.String localSaveDirectoryPath,
java.lang.String localSaveName)
public static boolean downloadFTPorHTTPFile(java.lang.String urlString,
java.lang.String localSaveDirectoryPath)
public void setLocs(boolean local,
java.net.URL url,
java.lang.String f,
java.lang.String d)
public void setPath(java.lang.String path)
public java.lang.String getPath()
public void setFileName(java.lang.String fileName)
public void changeLocation(java.lang.String directoryName,
java.lang.String fileName)
public boolean changeLocation(java.lang.String message)
public static java.lang.String saveFileAsDialog(java.lang.String message)
public static java.lang.String saveFileAsDialog(java.lang.String message,
java.lang.StringBuffer fileNameBuffer)
public static java.lang.String chooseDirectory(java.lang.String message)
public static java.lang.String chooseDirectory(java.lang.String message,
java.lang.String suggestedDir)
public static java.lang.String openFileDialog(java.lang.String message,
MesquiteString directoryName,
MesquiteString fileName)
public boolean isLocal()
public void setProject(MesquiteProject proj)
public MesquiteProject getProject()
public boolean openReading()
public void closeReading()
public boolean openWriting(boolean ascii)
public void writeLine(java.lang.String s)
public void write(java.lang.String s)
public void closeWriting()
public void closeWriting(int numBackups)
public boolean isWriting()
public java.lang.String getDirectoryName()
public java.lang.String getFileName()
public java.net.URL getURL()
public static java.lang.String getDirectoryPathFromFilePath(java.lang.String path)
public static java.lang.String getFileNameFromFilePath(java.lang.String path)
public static java.lang.String composePath(java.lang.String d,
java.lang.String f)
public static java.lang.String decomposePath(java.lang.String relativeTo,
java.lang.String path)
public static java.lang.String massageStringToFilePathSafe(java.lang.String path)
public static java.lang.String massageFilePathToURL(java.lang.String path)
public void linkProgressIndicator(ProgressIndicator pi)
public boolean getFileAborted()
public java.lang.String readLine(java.lang.String endLine)
public boolean readLine(java.lang.StringBuffer buffer)
public java.lang.String readLine()
public static java.lang.String readLine(java.io.InputStream inStream,
java.lang.StringBuffer sBuff,
MesquiteInteger remnantChar)
public java.lang.String readNextDarkLine()
public java.lang.String firstToken(java.lang.StringBuffer commentBuffer)
public java.lang.String nextToken(java.lang.StringBuffer commentBuffer)
public java.lang.String getNextCommand(MesquiteInteger status,
java.lang.StringBuffer commandComments,
boolean includeEntireCommand)
public java.lang.String getNextCommand(MesquiteInteger status,
java.lang.StringBuffer commandComments)
public void skipNextCommand(MesquiteInteger status)
public FileBlock getNextBlockOLD(MesquiteString blockName,
java.lang.StringBuffer fileComments,
java.lang.StringBuffer blockComments)
public FileBlock getNextBlock(MesquiteString blockName,
java.lang.StringBuffer fileComments,
java.lang.StringBuffer blockComments)
public long getFilePosition()
public void goToFilePosition(long pos)
public java.lang.String goToNextBlockStart(MesquiteLong startPos)
public void addFileElement(FileElement element)
public void removeFileElement(FileElement element)
public ListableVector getFileElements()
public static boolean deleteFile(java.lang.String path)
public static boolean deleteDirectory(java.lang.String directoryPath)
public static boolean fileExists(java.lang.String path)
public static boolean canWrite(java.lang.String path)
public static java.lang.String checkFilePath(java.lang.String path,
java.lang.String selectMessage)
public static java.lang.String getFileFirstContents(java.lang.String relativePath)
public static java.lang.String[] getFileContentsAsStrings(java.lang.String relativePath)
public static java.lang.String[][] getTabDelimitedTextFile(java.lang.String relativePath)
public static java.lang.String getFileContentsAsString(java.lang.String relativePath)
public java.lang.String getFileContentsAsString(int maxCharacters)
public static java.lang.String getFileContentsAsString(java.lang.String relativePath,
int maxCharacters)
public static java.lang.String getFileContentsAsString(java.lang.String relativePath,
int maxCharacters,
int startBufferSize)
public static java.lang.String getFileContentsAsString(java.lang.String relativePath,
int maxCharacters,
int startBufferSize,
boolean warnIfProblem)
public static java.lang.String getFileContentsAsStringOld(java.lang.String relativePath,
int maxCharacters,
int startBufferSize)
public static java.lang.String getURLContentsAsString(java.lang.String path,
int maxCharacters)
public static java.lang.String getURLContentsAsString(java.lang.String path,
int maxCharacters,
boolean warnIfProblem)
public static java.lang.String[] getURLContentsAsStrings(java.lang.String path)
public static void putFileContentsQuery(java.lang.String message,
java.lang.String output,
boolean ascii)
public static void putFileContents(java.lang.String relativePath,
java.lang.String[] contents,
boolean ascii)
public static void putFileContents(java.lang.String relativePath,
java.util.Vector contents,
boolean ascii)
public static void putFileContents(java.lang.String relativePath,
java.lang.String contents,
boolean ascii)
public static void appendFileContents(java.lang.String relativePath,
java.lang.String contents,
boolean ascii)
public static void writeToLog(java.lang.String s)
public static java.io.PrintWriter getLogWriter()
public static void throwableToLog(java.lang.Object obj,
java.lang.Throwable e)
public static void closeLog()
public boolean getWriteProtected()
public void setWriteProtected(boolean prot)
public void setAnnotation(java.lang.String e,
boolean notify)
public java.lang.String getAnnotation()
public java.lang.String getExplanation()
getExplanation in interface Explainablepublic HNode[] getHDaughters()
getHDaughters in interface HNodepublic HNode getHMother()
getHMother in interface HNodepublic java.lang.String getName()
getName in interface HNodegetName in interface Listablepublic java.lang.String getTypeName()
getTypeName in interface HNodepublic int getNumSupplements()
getNumSupplements in interface HNodepublic java.lang.String getSupplementName(int index)
getSupplementName in interface HNode
public void hNodeAction(java.awt.Container c,
int x,
int y,
int action)
hNodeAction in interface HNodepublic void hSupplementTouched(int index)
hSupplementTouched in interface HNodepublic java.awt.Image getHImage()
getHImage in interface HNodepublic java.awt.Color getHColor()
getHColor in interface HNodepublic boolean getHShow()
getHShow in interface HNode
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||