public final class DefaultFileContent extends java.lang.Object implements FileContent
| Constructor and Description |
|---|
DefaultFileContent(AbstractFileObject file,
FileContentInfoFactory fileContentInfoFactory) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all resources used by the content, including all streams, readers
and writers.
|
java.lang.Object |
getAttribute(java.lang.String attrName)
Gets the value of an attribute.
|
java.lang.String[] |
getAttributeNames()
Lists the attributes of this file.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAttributes()
Returns a read-only map of this file's attributes.
|
java.security.cert.Certificate[] |
getCertificates()
Returns the certificates used to sign this file.
|
FileContentInfo |
getContentInfo()
get the content info.
|
FileObject |
getFile()
Returns the file that this is the content of.
|
java.io.InputStream |
getInputStream()
Returns an input stream for reading the content.
|
long |
getLastModifiedTime()
Returns the last-modified timestamp.
|
java.io.OutputStream |
getOutputStream()
Returns an output stream for writing the content.
|
java.io.OutputStream |
getOutputStream(boolean bAppend)
Returns an output stream for writing the content in append mode.
|
RandomAccessContent |
getRandomAccessContent(RandomAccessMode mode)
Returns an input/output stream to use to read and write the content of the file in an
random manner.
|
long |
getSize()
Returns the size of the content (in bytes).
|
boolean |
hasAttribute(java.lang.String attrName)
Checks if an attribute exists.
|
boolean |
isOpen()
check if a input and/or output stream is open.
This checks only the scope of the current thread. |
boolean |
isOpenGlobal()
check if a input and/or output stream is open.
This checks all threads. |
void |
removeAttribute(java.lang.String attrName)
Removes an attribute.
|
void |
resetAttributes()
Used internally to flag situations where the file attributes should be
reretrieved.
|
void |
setAttribute(java.lang.String attrName,
java.lang.Object value)
Sets the value of an attribute.
|
void |
setLastModifiedTime(long modTime)
Sets the last-modified timestamp.
|
public DefaultFileContent(AbstractFileObject file, FileContentInfoFactory fileContentInfoFactory)
public FileObject getFile()
getFile in interface FileContentpublic long getSize()
throws FileSystemException
getSize in interface FileContentFileSystemException - if an error occurs.public long getLastModifiedTime()
throws FileSystemException
getLastModifiedTime in interface FileContentFileSystemException - if an error occurs.public void setLastModifiedTime(long modTime)
throws FileSystemException
setLastModifiedTime in interface FileContentmodTime - The last modified timestamp.FileSystemException - if an error occurs.public boolean hasAttribute(java.lang.String attrName)
throws FileSystemException
hasAttribute in interface FileContentattrName - The name of the attribute to check.FileSystemException - if an error occurs.public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
throws FileSystemException
getAttributes in interface FileContentFileSystemException - if an error occurs.public void resetAttributes()
public java.lang.String[] getAttributeNames()
throws FileSystemException
getAttributeNames in interface FileContentFileSystemException - if an error occurs.public java.lang.Object getAttribute(java.lang.String attrName)
throws FileSystemException
getAttribute in interface FileContentattrName - The attribute name.FileSystemException - if an error occurs.public void setAttribute(java.lang.String attrName,
java.lang.Object value)
throws FileSystemException
setAttribute in interface FileContentattrName - The name of the attribute to add.value - The value of the attribute.FileSystemException - if an error occurs.public void removeAttribute(java.lang.String attrName)
throws FileSystemException
removeAttribute in interface FileContentattrName - The name of the attribute to remove.FileSystemException - if an error occurs.public java.security.cert.Certificate[] getCertificates()
throws FileSystemException
getCertificates in interface FileContentFileSystemException - if an error occurs.public java.io.InputStream getInputStream()
throws FileSystemException
getInputStream in interface FileContentFileSystemException - if an error occurs.public RandomAccessContent getRandomAccessContent(RandomAccessMode mode) throws FileSystemException
getRandomAccessContent in interface FileContentmode - The RandomAccessMode.FileSystemException - if an error occurs.public java.io.OutputStream getOutputStream()
throws FileSystemException
getOutputStream in interface FileContentFileSystemException - if an error occurs.public java.io.OutputStream getOutputStream(boolean bAppend)
throws FileSystemException
getOutputStream in interface FileContentbAppend - true if the data written should be appended.FileSystemException - if an error occurs.public void close()
throws FileSystemException
close in interface FileContentFileSystemException - if an error occurs.public boolean isOpen()
isOpen in interface FileContentpublic boolean isOpenGlobal()
public FileContentInfo getContentInfo() throws FileSystemException
getContentInfo in interface FileContentFileSystemException - if an error occurs.