|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.vfs.provider.DefaultFileContent
The content of a file.
Constructor Summary | |
DefaultFileContent(AbstractFileObject file,
FileContentInfoFactory fileContentInfoFactory)
|
Method Summary | |
void |
close()
Closes all resources used by the content, including all streams, readers and writers. |
Object |
getAttribute(String attrName)
Gets the value of an attribute. |
String[] |
getAttributeNames()
Lists the attributes of this file. |
Map |
getAttributes()
Returns a read-only map of this file's attributes. |
Certificate[] |
getCertificates()
Returns the certificates used to sign this file. |
FileContentInfo |
getContentInfo()
get the content info. e.g. content-type, content-encoding |
FileObject |
getFile()
Returns the file that this is the content of. |
InputStream |
getInputStream()
Returns an input stream for reading the content. |
long |
getLastModifiedTime()
Returns the last-modified timestamp. |
OutputStream |
getOutputStream()
Returns an output stream for writing the content. |
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 |
isOpen()
check if a input and/or output stream is open. |
boolean |
isOpenGlobal()
check if a input and/or output stream is open. |
void |
setAttribute(String attrName,
Object value)
Sets the value of an attribute. |
void |
setLastModifiedTime(long modTime)
Sets the last-modified timestamp. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultFileContent(AbstractFileObject file, FileContentInfoFactory fileContentInfoFactory)
Method Detail |
public FileObject getFile()
getFile
in interface FileContent
public long getSize() throws FileSystemException
getSize
in interface FileContent
FileSystemException
- If the file does not exist, or is being written to, or on error
determining the size.public long getLastModifiedTime() throws FileSystemException
getLastModifiedTime
in interface FileContent
FileSystemException
- If the file does not exist, or is being written to, or on error
determining the last-modified timestamp.public void setLastModifiedTime(long modTime) throws FileSystemException
setLastModifiedTime
in interface FileContent
modTime
- The time to set the last-modified timestamp to.
FileSystemException
- If the file is read-only, or is being written to, or on error
setting the last-modified timestamp.public Map getAttributes() throws FileSystemException
getAttributes
in interface FileContent
FileSystemException
- If the file does not exist, or does not support attributes.public String[] getAttributeNames() throws FileSystemException
getAttributeNames
in interface FileContent
FileSystemException
- If the file does not exist, or does not support attributes.public Object getAttribute(String attrName) throws FileSystemException
getAttribute
in interface FileContent
attrName
- The name of the attribute. Attribute names are case insensitive.
FileSystemException
- If the file does not exist, or does not support attributes.public void setAttribute(String attrName, Object value) throws FileSystemException
setAttribute
in interface FileContent
attrName
- The name of the attribute.value
- The value of the attribute.
FileSystemException
- If the file does not exist, or is read-only, or does not support
attributes, or on error setting the attribute.public Certificate[] getCertificates() throws FileSystemException
getCertificates
in interface FileContent
FileSystemException
- If the file does not exist, or is being written.public InputStream getInputStream() throws FileSystemException
getInputStream
in interface FileContent
BufferedInputStream
.
FileSystemException
- If the file does not exist, or is being read, or is being written,
or on error opening the stream.public RandomAccessContent getRandomAccessContent(RandomAccessMode mode) throws FileSystemException
getRandomAccessContent
in interface FileContent
FileSystemException
- If the file is read-only, or is being read, or is being written,
or on error opening the stream.public OutputStream getOutputStream() throws FileSystemException
getOutputStream
in interface FileContent
BufferedOutputStream
.
FileSystemException
- If the file is read-only, or is being read, or is being written,
or on error opening the stream.public OutputStream getOutputStream(boolean bAppend) throws FileSystemException
getOutputStream
in interface FileContent
bAppend
- true if you would like to append to the file
BufferedOutputStream
.
FileSystemException
- If the file is read-only, or is being read, or is being written,
or on error opening the stream.public void close() throws FileSystemException
close
in interface FileContent
FileSystemException
public boolean isOpen()
isOpen
in interface FileContent
public boolean isOpenGlobal()
public FileContentInfo getContentInfo() throws FileSystemException
getContentInfo
in interface FileContent
FileSystemException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |