FS
- An HttpFileSystem
subclasspublic class HttpFileObject<FS extends HttpFileSystem> extends AbstractFileObject<FS>
TODO - status codes.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
HttpFileObject.HttpInputStream
An InputStream that cleans up the HTTP connection on close.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
followRedirect |
private org.apache.commons.httpclient.methods.HeadMethod |
method |
private java.lang.String |
urlCharset |
private java.lang.String |
userAgent |
Modifier | Constructor and Description |
---|---|
protected |
HttpFileObject(AbstractFileName name,
FS fileSystem) |
protected |
HttpFileObject(AbstractFileName name,
FS fileSystem,
HttpFileSystemConfigBuilder builder) |
Modifier and Type | Method and Description |
---|---|
protected void |
doDetach()
Detaches this file object from its file resource.
|
protected long |
doGetContentSize()
Returns the size of the file content (in bytes).
|
protected java.io.InputStream |
doGetInputStream()
Creates an input stream to read the file content from.
|
protected long |
doGetLastModifiedTime()
Returns the last modified time of this file.
|
protected RandomAccessContent |
doGetRandomAccessContent(RandomAccessMode mode)
Creates access to the file for random i/o.
|
protected FileType |
doGetType()
Determines the type of this file.
|
protected boolean |
doIsWriteable()
Determines if this file can be written to.
|
protected java.lang.String[] |
doListChildren()
Lists the children of this file.
|
protected java.lang.String |
encodePath(java.lang.String decodedPath) |
protected FileContentInfoFactory |
getFileContentInfoFactory()
create the filecontentinfo implementation.
|
protected boolean |
getFollowRedirect() |
(package private) org.apache.commons.httpclient.methods.HeadMethod |
getHeadMethod() |
protected java.lang.String |
getUrlCharset() |
protected java.lang.String |
getUserAgent() |
protected void |
setupMethod(org.apache.commons.httpclient.HttpMethod method)
Prepares a HttpMethod object.
|
canRenameTo, childrenChanged, close, compareTo, copyFrom, createFile, createFolder, delete, delete, deleteAll, doAttach, doCreateFileContent, doCreateFolder, doDelete, doGetAttributes, doGetCertificates, doGetOutputStream, doIsExecutable, doIsHidden, doIsReadable, doIsSameFile, doListChildrenResolved, doRemoveAttribute, doRename, doSetAttribute, doSetExecutable, doSetLastModifiedTime, doSetReadable, doSetWritable, endOutput, exists, finalize, findFiles, findFiles, getAbstractFileSystem, getChild, getChildren, getContent, getFileOperations, getFileSystem, getInputStream, getName, getOutputStream, getOutputStream, getParent, getPublicURIString, getRandomAccessContent, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isExecutable, isFile, isFolder, isHidden, isReadable, isSameFile, isWriteable, iterator, listFiles, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, resolveFile, resolveFile, setExecutable, setReadable, setWritable, toString
private final java.lang.String urlCharset
private final java.lang.String userAgent
private final boolean followRedirect
private org.apache.commons.httpclient.methods.HeadMethod method
protected HttpFileObject(AbstractFileName name, FS fileSystem)
protected HttpFileObject(AbstractFileName name, FS fileSystem, HttpFileSystemConfigBuilder builder)
protected void doDetach() throws java.lang.Exception
doDetach
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected long doGetContentSize() throws java.lang.Exception
doGetContentSize
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected java.io.InputStream doGetInputStream() throws java.lang.Exception
doGetType()
returns FileType.FILE
.
It is guaranteed that there are no open output streams for this file when this method is called.
The returned stream does not have to be buffered.
doGetInputStream
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected long doGetLastModifiedTime() throws java.lang.Exception
This implementation throws an exception.
doGetLastModifiedTime
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected RandomAccessContent doGetRandomAccessContent(RandomAccessMode mode) throws java.lang.Exception
AbstractFileObject
AbstractFileObject.doGetType()
returns FileType.FILE
.
It is guaranteed that there are no open output streams for this file when this method is called.
doGetRandomAccessContent
in class AbstractFileObject<FS extends HttpFileSystem>
mode
- The mode to access the file.java.lang.Exception
- if an error occurs.protected FileType doGetType() throws java.lang.Exception
doGetType
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected boolean doIsWriteable() throws java.lang.Exception
AbstractFileObject
AbstractFileObject.doGetType()
does not return FileType.IMAGINARY
.
This implementation always returns true.
doIsWriteable
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected java.lang.String[] doListChildren() throws java.lang.Exception
doListChildren
in class AbstractFileObject<FS extends HttpFileSystem>
java.lang.Exception
- if an error occurs.protected java.lang.String encodePath(java.lang.String decodedPath) throws org.apache.commons.httpclient.URIException
org.apache.commons.httpclient.URIException
protected FileContentInfoFactory getFileContentInfoFactory()
AbstractFileObject
getFileContentInfoFactory
in class AbstractFileObject<FS extends HttpFileSystem>
protected boolean getFollowRedirect()
protected java.lang.String getUserAgent()
org.apache.commons.httpclient.methods.HeadMethod getHeadMethod() throws java.io.IOException
java.io.IOException
protected java.lang.String getUrlCharset()
protected void setupMethod(org.apache.commons.httpclient.HttpMethod method) throws FileSystemException, org.apache.commons.httpclient.URIException
method
- The object which gets prepared to access the file object.FileSystemException
- if an error occurs.org.apache.commons.httpclient.URIException
- if path cannot be represented.