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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
delete()
Deletes this file.findSibling
(String name, boolean create) Finds a file with the specified name in the same folder.abstract GLMapStorage
Returns this file as a storageabstract long
Returns the last modified timestamp of the file.abstract long
Returns the size of the file in bytes.abstract String
getName()
Gets the name of this file.getPath()
Gets the full path of this file.abstract GLMapStorage
Returns the storage that contains this file.abstract String
Gets the VFS (Virtual File System) name of this file.abstract boolean
Returns true if this object is a directoryabstract int
Opens the file for reading.abstract int
openForWriting
(boolean truncate) Opens the file for writing.abstract InputStream
Opens an input stream to read from this file.abstract OutputStream
Opens an output stream to write to this file.abstract boolean
setLastModified
(long lastModified) Sets the last modified timestamp of the file.abstract boolean
Sets the name of this file.boolean
truncate()
Truncates the file to zero length.
-
Constructor Details
-
GLMapStorageFile
public GLMapStorageFile()
-
-
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
-