FS
- An Http4FileSystem
subclasspublic class Http4FileObject<FS extends Http4FileSystem> extends AbstractFileObject<FS>
Modifier and Type | Field and Description |
---|---|
private java.net.URI |
internalURI
Internal URI mapped to this
FileObject . |
private org.apache.http.HttpResponse |
lastHeadResponse
The last executed HEAD
HttpResponse object. |
private java.lang.String |
urlCharset
URL charset string.
|
Modifier | Constructor and Description |
---|---|
protected |
Http4FileObject(AbstractFileName name,
FS fileSystem)
Construct
Http4FileObject . |
protected |
Http4FileObject(AbstractFileName name,
FS fileSystem,
Http4FileSystemConfigBuilder builder)
Construct
Http4FileObject . |
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.
|
(package private) org.apache.http.HttpResponse |
executeHttpUriRequest(org.apache.http.client.methods.HttpUriRequest httpRequest)
Execute the request using the given
httpRequest and return a HttpResponse from the execution. |
protected FileContentInfoFactory |
getFileContentInfoFactory()
Creates the FileContentInfo factory.
|
protected java.net.URI |
getInternalURI()
Return the internal
URI object mapped to this file object. |
(package private) org.apache.http.HttpResponse |
getLastHeadResponse()
Return the last executed HEAD
HttpResponse object. |
protected java.lang.String |
getUrlCharset()
Return URL charset string.
|
canRenameTo, childrenChanged, close, compareTo, copyFrom, createFile, createFolder, delete, delete, deleteAll, doAttach, doCreateFileContent, doCreateFolder, doDelete, doGetAttributes, doGetCertificates, doGetOutputStream, doIsExecutable, doIsHidden, doIsReadable, doIsSameFile, doIsSymbolicLink, 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, isSymbolicLink, isWriteable, iterator, listFiles, moveTo, notifyAllStreamsClosed, onChange, onChildrenChanged, refresh, resolveFile, resolveFile, setExecutable, setReadable, setWritable, toString
private final java.lang.String urlCharset
private final java.net.URI internalURI
FileObject
.
For example, the internal URI of http4://example.com/a.txt
is http://example.com/a.txt
.private org.apache.http.HttpResponse lastHeadResponse
HttpResponse
object.protected Http4FileObject(AbstractFileName name, FS fileSystem) throws FileSystemException, java.net.URISyntaxException
Http4FileObject
.name
- file namefileSystem
- file systemFileSystemException
- if any error occursjava.net.URISyntaxException
- if given file name cannot be converted to a URI due to URI syntax errorprotected Http4FileObject(AbstractFileName name, FS fileSystem, Http4FileSystemConfigBuilder builder) throws FileSystemException, java.net.URISyntaxException
Http4FileObject
.name
- file namefileSystem
- file systembuilder
- Http4FileSystemConfigBuilder
objectFileSystemException
- if any error occursjava.net.URISyntaxException
- if given file name cannot be converted to a URI due to URI syntax errorprotected FileType doGetType() throws java.lang.Exception
AbstractFileObject
doGetType
in class AbstractFileObject<FS extends Http4FileSystem>
java.lang.Exception
- if an error occurs.protected long doGetContentSize() throws java.lang.Exception
AbstractFileObject
AbstractFileObject.doGetType()
returns
FileType.FILE
.doGetContentSize
in class AbstractFileObject<FS extends Http4FileSystem>
java.lang.Exception
- if an error occurs.protected long doGetLastModifiedTime() throws java.lang.Exception
AbstractFileObject
AbstractFileObject.doGetType()
does not return
FileType.IMAGINARY
.
This implementation throws an exception.
doGetLastModifiedTime
in class AbstractFileObject<FS extends Http4FileSystem>
java.lang.Exception
- if an error occurs.protected java.io.InputStream doGetInputStream() 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.
The returned stream does not have to be buffered.
doGetInputStream
in class AbstractFileObject<FS extends Http4FileSystem>
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 Http4FileSystem>
mode
- The mode to access the file.java.lang.Exception
- if an error occurs.protected java.lang.String[] doListChildren() throws java.lang.Exception
AbstractFileObject
AbstractFileObject.doGetType()
returns FileType.FOLDER
. The return
value of this method is cached, so the implementation can be expensive.doListChildren
in class AbstractFileObject<FS extends Http4FileSystem>
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 Http4FileSystem>
java.lang.Exception
- if an error occurs.protected FileContentInfoFactory getFileContentInfoFactory()
AbstractFileObject
getFileContentInfoFactory
in class AbstractFileObject<FS extends Http4FileSystem>
protected void doDetach() throws java.lang.Exception
AbstractFileObject
Called when this file is closed. Note that the file object may be reused later, so should be able to be reattached.
This implementation does nothing.
doDetach
in class AbstractFileObject<FS extends Http4FileSystem>
java.lang.Exception
- if an error occurs.protected java.lang.String getUrlCharset()
protected java.net.URI getInternalURI() throws FileSystemException
URI
object mapped to this file object.URI
object mapped to this file objectFileSystemException
- if any error occursorg.apache.http.HttpResponse getLastHeadResponse() throws java.io.IOException
HttpResponse
object.HttpResponse
objectjava.io.IOException
- if IO error occursorg.apache.http.HttpResponse executeHttpUriRequest(org.apache.http.client.methods.HttpUriRequest httpRequest) throws java.io.IOException
httpRequest
and return a HttpResponse
from the execution.httpRequest
- HttpUriRequest
objectHttpResponse
from the executionjava.io.IOException
- if IO error occurs