public class WebFileObject extends FileObject
Modifier and Type | Field and Description |
---|---|
protected static java.util.logging.Logger |
logger |
int |
METADATA_FRESH_TIMEOUT_MS |
Modifier | Constructor and Description |
---|---|
protected |
WebFileObject(WebFileSystem wfs,
java.lang.String pathname,
java.util.Date modifiedDate) |
Modifier and Type | Method and Description |
---|---|
boolean |
canRead()
returns true if the file can be read by the client.
|
boolean |
exists()
returns true if the file exists.
|
java.nio.channels.ReadableByteChannel |
getChannel(ProgressMonitor monitor)
return a Channel for the resource.
|
FileObject[] |
getChildren()
returns objects within a folder.
|
java.io.File |
getFile(ProgressMonitor monitor)
return the file for the WebFileObject.
|
java.io.InputStream |
getInputStream(ProgressMonitor monitor)
opens an inputStream, perhaps transferring the file to a
cache first.
|
protected java.io.File |
getLocalFile()
returns the File that corresponds to the remote file.
|
java.lang.String |
getNameExt()
returns the canonical name of the file within the filesystem.
|
FileObject |
getParent()
returns the parent FileObject (a folder).
|
long |
getSize()
return the fileObject size in bytes.
|
boolean |
isData()
returns true if the file is a data file that to be used
reading or writing data.
|
boolean |
isFolder()
indicates the type of FileObject
|
boolean |
isLocal()
returns true is the file is locally available, meaning clients can
call getFile() and the readable File reference will be available in
interactive time.
|
boolean |
isReadOnly()
true is the file is read-only.
|
boolean |
isRoot()
returns true if this is the root of the filesystem it came from.
|
java.util.Date |
lastModified()
returns the Date when the file was last modified.
|
protected void |
maybeLoadMetadata()
load the metadata for the file object, presently only for HTTP doing a HEAD request.
|
boolean |
removeLocalFile()
remove the local file in the cache, if any.
|
protected void |
setLastModified(java.util.Date d)
allow subclasses, such as FtpBeanFileSystem, to delay loading of the date.
|
protected void |
setSize(long size)
allow classes to delay loading of the size.
|
java.lang.String |
toString() |
getCapability, getChannel, getFile, getInputStream
protected static final java.util.logging.Logger logger
public int METADATA_FRESH_TIMEOUT_MS
protected WebFileObject(WebFileSystem wfs, java.lang.String pathname, java.util.Date modifiedDate)
public boolean canRead()
FileObject
canRead
in class FileObject
protected void maybeLoadMetadata() throws java.io.IOException
java.io.IOException
public FileObject[] getChildren() throws java.io.IOException
FileObject
getChildren
in class FileObject
java.io.IOException
public java.io.InputStream getInputStream(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
FileObject
getInputStream
in class FileObject
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 FileObject getParent()
FileObject
getParent
in class FileObject
public boolean isData()
FileObject
isData
in class FileObject
public boolean isFolder()
FileObject
isFolder
in class FileObject
public boolean isReadOnly()
FileObject
isReadOnly
in class FileObject
public boolean isRoot()
FileObject
isRoot
in class FileObject
public java.util.Date lastModified()
FileObject
lastModified
in class FileObject
public long getSize()
getSize
in class FileObject
protected void setLastModified(java.util.Date d)
d
- protected void setSize(long size)
size
- the size in bytes of the file.java.lang.IllegalArgumentException
- if the size is reset to a different value from a valid value.protected java.io.File getLocalFile()
public boolean removeLocalFile()
FileObject
removeLocalFile
in class FileObject
public boolean exists()
FileObject
exists
in class FileObject
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getNameExt()
FileObject
getNameExt
in class FileObject
public java.nio.channels.ReadableByteChannel getChannel(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
getChannel
in class FileObject
monitor
- java.io.FileNotFoundException
java.io.IOException
public java.io.File getFile(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
getFile
in class FileObject
monitor
- java.io.FileNotFoundException
java.io.IOException
public boolean isLocal()
isLocal
in class FileObject