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, getInputStreamprotected 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()
FileObjectcanRead in class FileObjectprotected void maybeLoadMetadata()
throws java.io.IOException
java.io.IOExceptionpublic FileObject[] getChildren() throws java.io.IOException
FileObjectgetChildren in class FileObjectjava.io.IOExceptionpublic java.io.InputStream getInputStream(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
FileObjectgetInputStream in class FileObjectmonitor - 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.IOExceptionpublic FileObject getParent()
FileObjectgetParent in class FileObjectpublic boolean isData()
FileObjectisData in class FileObjectpublic boolean isFolder()
FileObjectisFolder in class FileObjectpublic boolean isReadOnly()
FileObjectisReadOnly in class FileObjectpublic boolean isRoot()
FileObjectisRoot in class FileObjectpublic java.util.Date lastModified()
FileObjectlastModified in class FileObjectpublic long getSize()
getSize in class FileObjectprotected 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()
FileObjectremoveLocalFile in class FileObjectpublic boolean exists()
FileObjectexists in class FileObjectpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getNameExt()
FileObjectgetNameExt in class FileObjectpublic java.nio.channels.ReadableByteChannel getChannel(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
getChannel in class FileObjectmonitor - java.io.FileNotFoundExceptionjava.io.IOExceptionpublic java.io.File getFile(ProgressMonitor monitor) throws java.io.FileNotFoundException, java.io.IOException
getFile in class FileObjectmonitor - java.io.FileNotFoundExceptionjava.io.IOExceptionpublic boolean isLocal()
isLocal in class FileObject