Package globus.glmap
Class GLMapStorageFile
java.lang.Object
globus.glmap.GLMapStorageFile
- Direct Known Subclasses:
GLMapDocumentTreeStorage.FileInfo,GLMapFileStorage.FileInfo
Abstract class representing a file in storage.
-
Method Summary
Modifier and TypeMethodDescriptionabstract booleandelete()Deletes this file.findSibling(String name, boolean create) Finds a file with the specified name in the same folder.abstract GLMapStorageReturns this file as a storageabstract longReturns the last modified timestamp of the file.abstract longReturns the size of the file in bytes.abstract StringgetName()Gets the name of this file.getPath()Gets the full path of this file.abstract GLMapStorageReturns the storage that contains this file.abstract StringGets the VFS (Virtual File System) name of this file.abstract booleanReturns true if this object is a directoryabstract intOpens the file for reading.abstract intopenForWriting(boolean truncate) Opens the file for writing.abstract InputStreamOpens an input stream to read from this file.abstract OutputStreamOpens an output stream to write to this file.abstract booleansetLastModified(long lastModified) Sets the last modified timestamp of the file.abstract booleanSets the name of this file.booleantruncate()Truncates the file to zero length.
-
Method Details
-
findSibling
Finds a file with the specified name in the same folder.- Parameters:
name- the name of the file to findcreate- if true, creates the file if it does not exist- Returns:
- the file with the specified name, or null if not found and create is false
-
getStorage
Returns the storage that contains this file.- Returns:
- the storage containing this file
-
isDirectory
public abstract boolean isDirectory()Returns true if this object is a directory- Returns:
- true if this object is a directory
-
getAsStorage
Returns this file as a storage- Returns:
- storage if this object is a directory, otherwise null
-
delete
public abstract boolean delete()Deletes this file.- Returns:
- true if the file was successfully deleted, false otherwise
-
truncate
public boolean truncate()Truncates the file to zero length.- Returns:
- true if the file was successfully truncated, false otherwise
-
getPath
Gets the full path of this file.- Returns:
- the full path of this file, or null if the name is null
-
getName
Gets the name of this file.- Returns:
- the name of the file, or null if it has no name
-
setName
Sets the name of this file.- Parameters:
newName- the new name to set- Returns:
- true if the name was successfully set, false otherwise
-
getVFSName
Gets the VFS (Virtual File System) name of this file.- Returns:
- the VFS name of the file, or null if it has no VFS name
-
openInputStream
Opens an input stream to read from this file.- Returns:
- an input stream to read from the file
- Throws:
FileNotFoundException- if the file cannot be found
-
openOutputStream
Opens an output stream to write to this file.- Returns:
- an output stream to write to the file
- Throws:
FileNotFoundException- if the file cannot be found
-
openForReading
public abstract int openForReading()Opens the file for reading.- Returns:
- a file descriptor for reading from the file
-
openForWriting
public abstract int openForWriting(boolean truncate) Opens the file for writing.- Parameters:
truncate- if true, truncates the file to zero length before writing- Returns:
- a file descriptor for writing to the file
-
getLength
public abstract long getLength()Returns the size of the file in bytes.- Returns:
- the size of the file in bytes
-
getLastModified
public abstract long getLastModified()Returns the last modified timestamp of the file.- Returns:
- the last modified timestamp of the file
-
setLastModified
public abstract boolean setLastModified(long lastModified) Sets the last modified timestamp of the file.- Parameters:
lastModified- the new last modified timestamp- Returns:
- true if the timestamp was successfully set, false otherwise
-