public abstract class FileObject
extends java.lang.Object
Class for describing and accessing files in file systems. This is similar to java.io.File, except that it can describe files on remote file systems like an ftp site.
Note: this is modelled after the NetBeans fileSystem FileObject, with the thought that we might use it later.
Constructor and Description |
---|
FileObject() |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
canRead()
returns true if the file can be read by the client.
|
abstract boolean |
exists()
returns true if the file exists.
|
<T> T |
getCapability(java.lang.Class<T> clazz)
returns extra capabilities, such as writing to the filesystem.
|
java.nio.channels.ReadableByteChannel |
getChannel()
opens a Channel, but without a monitor.
|
abstract java.nio.channels.ReadableByteChannel |
getChannel(ProgressMonitor monitor)
opens a Channel, perhaps transferring the file to a local cache first.
|
abstract FileObject[] |
getChildren()
returns objects within a folder.
|
java.io.File |
getFile()
gets a File object that can be opened by the client.
|
abstract java.io.File |
getFile(ProgressMonitor monitor)
gets a File object that can be opened by the client.
|
java.io.InputStream |
getInputStream()
opens an inputStream, perhaps transferring the file to a
cache first.
|
abstract java.io.InputStream |
getInputStream(ProgressMonitor monitor)
opens an inputStream, perhaps transferring the file to a
cache first.
|
abstract java.lang.String |
getNameExt()
returns the canonical name of the file within the filesystem.
|
abstract FileObject |
getParent()
returns the parent FileObject (a folder).
|
abstract long |
getSize()
returns the size of the file.
|
abstract boolean |
isData()
returns true if the file is a data file that to be used
reading or writing data.
|
abstract boolean |
isFolder()
indicates the type of FileObject
|
abstract boolean |
isLocal()
returns true if the file is locally available, meaning clients can
call getFile() and the readable File reference will be available in
interactive time.
|
abstract boolean |
isReadOnly()
true is the file is read-only.
|
abstract boolean |
isRoot()
returns true if this is the root of the filesystem it came from.
|
abstract java.util.Date |
lastModified()
returns the Date when the file was last modified.
|
boolean |
removeLocalFile()
remove the local file in the cache, if any.
|
public abstract boolean canRead()
public abstract FileObject[] getChildren() throws java.io.IOException
java.io.IOException
public abstract java.io.InputStream getInputStream(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
monitor
- for monitoring the download. The monitor won't be used when the access
is immediate, for example with local FileObjects.java.io.FileNotFoundException
- if the file doesn't exist.java.io.IOException
public java.io.InputStream getInputStream() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
- if the file doesn't exist.java.io.IOException
public abstract java.nio.channels.ReadableByteChannel getChannel(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
monitor
- for monitoring the download. The monitor won't be used when the access
is immediate, for example with local FileObjects.java.io.FileNotFoundException
- if the file doesn't exist.java.io.IOException
public java.nio.channels.ReadableByteChannel getChannel() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
- if the file doesn't exist.java.io.IOException
public abstract java.io.File getFile(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
monitor
- for monitoring the download. The monitor won't be used when the access
is immediate, for example with local FileObjects.java.io.FileNotFoundException
- if the file doesn't exist.java.io.IOException
- if the file cannot be made localjava.lang.NullPointerException
- if the monitor is null.public java.io.File getFile() throws java.io.FileNotFoundException, java.io.IOException
java.io.FileNotFoundException
- if the file doesn't exist.java.io.IOException
public abstract FileObject getParent()
public abstract long getSize()
public abstract boolean isData()
public abstract boolean isFolder()
public abstract boolean isReadOnly()
public abstract boolean isRoot()
public abstract boolean isLocal()
public abstract boolean exists()
public abstract java.lang.String getNameExt()
public abstract java.util.Date lastModified()
public <T> T getCapability(java.lang.Class<T> clazz)
T
- public boolean removeLocalFile()