|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents the data content of a file.
To read from a file, use the InputStream
returned by
getInputStream()
.
To write to a file, use the OutputStream
returned by
getOutputStream()
method. This will create the file, and the parent
folder, if necessary.
A file may have multiple InputStreams open at the sametime.
FileObject.getContent()
Method Summary | |
void |
close()
Closes all resources used by the content, including any open stream. |
Object |
getAttribute(String attrName)
Gets the value of an attribute of the file's content. |
String[] |
getAttributeNames()
Lists the attributes of the file's content. |
Map |
getAttributes()
Returns a read-only map of this file's attributes. |
Certificate[] |
getCertificates()
Retrieves the certificates if any used to sign this file or folder. |
FileContentInfo |
getContentInfo()
get the content info. e.g. type, encoding, ... |
FileObject |
getFile()
Returns the file which this is the content of. |
InputStream |
getInputStream()
Returns an input stream for reading the file's content. |
long |
getLastModifiedTime()
Determines the last-modified timestamp of the file. |
OutputStream |
getOutputStream()
Returns an output stream for writing the file's content. |
OutputStream |
getOutputStream(boolean bAppend)
Returns an output stream for writing the file's content. |
RandomAccessContent |
getRandomAccessContent(RandomAccessMode mode)
Returns an stream for reading/writing the file's content. |
long |
getSize()
Determines the size of the file, in bytes. |
boolean |
isOpen()
check if this file has open streams |
void |
setAttribute(String attrName,
Object value)
Sets the value of an attribute of the file's content. |
void |
setLastModifiedTime(long modTime)
Sets the last-modified timestamp of the file. |
Method Detail |
public FileObject getFile()
public long getSize() throws FileSystemException
FileSystemException
- If the file does not exist, or is being written to, or on error
determining the size.public long getLastModifiedTime() throws FileSystemException
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
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
FileSystemException
- If the file does not exist, or does not support attributes.public String[] getAttributeNames() throws FileSystemException
FileSystemException
- If the file does not exist, or does not support attributes.public Object getAttribute(String attrName) throws FileSystemException
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
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
FileSystemException
- If the file does not exist, or is being written.public InputStream getInputStream() throws FileSystemException
There may only be a single input or output stream open for the file at any time.
BufferedInputStream
.
FileSystemException
- If the file does not exist, or is being read, or is being written,
or on error opening the stream.public OutputStream getOutputStream() throws FileSystemException
There may only be a single input or output stream open for the file at any time.
BufferedOutputStream
.
FileSystemException
- If the file is read-only, or is being read, or is being written,
or on error opening the stream.public RandomAccessContent getRandomAccessContent(RandomAccessMode mode) throws FileSystemException
There may only be a single input or output stream open for the file at any time.
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
There may only be a single input or output stream open for the file at any time.
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
This method is a hint to the implementation that it can release resources. This object can continue to be used after calling this method.
FileSystemException
public FileContentInfo getContentInfo() throws FileSystemException
FileSystemException
public boolean isOpen()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |