public final class DefaultFileContent extends 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.
|
Object |
getAttribute(String attrName)
Gets the value of an attribute.
|
String[] |
getAttributeNames()
Lists the attributes of this file.
|
Map<String,Object> |
getAttributes()
Returns a read-only map of this file's attributes.
|
Certificate[] |
getCertificates()
Returns the certificates used to sign this file.
|
FileContentInfo |
getContentInfo()
Gets the FileContentInfo which describes the 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 |
hasAttribute(String attrName)
Checks if an attribute exists.
|
boolean |
isOpen()
Checks if a input and/or output stream is open.
|
boolean |
isOpenGlobal()
Checks if an input or output stream is open.
|
void |
removeAttribute(String attrName)
Removes an attribute.
|
void |
resetAttributes()
Used internally to flag situations where the file attributes should be reretrieved.
|
void |
setAttribute(String attrName,
Object value)
Sets the value of an attribute.
|
void |
setLastModifiedTime(long modTime)
Sets the last-modified timestamp.
|
long |
write(FileContent fileContent)
Writes this content to another FileContent.
|
long |
write(FileObject file)
Writes this content to another FileObject.
|
long |
write(OutputStream output)
Writes this content to an OutputStream.
|
long |
write(OutputStream output,
int bufferSize)
Writes this content to an OutputStream.
|
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(String attrName) throws FileSystemException
hasAttribute in interface FileContentattrName - The name of the attribute to check.FileSystemException - if an error occurs.public Map<String,Object> getAttributes() throws FileSystemException
getAttributes in interface FileContentFileSystemException - if an error occurs.public void resetAttributes()
public String[] getAttributeNames() throws FileSystemException
getAttributeNames in interface FileContentFileSystemException - if an error occurs.public Object getAttribute(String attrName) throws FileSystemException
getAttribute in interface FileContentattrName - The attribute name.FileSystemException - if an error occurs.public void setAttribute(String attrName, 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(String attrName) throws FileSystemException
removeAttribute in interface FileContentattrName - The name of the attribute to remove.FileSystemException - if an error occurs.public Certificate[] getCertificates() throws FileSystemException
getCertificates in interface FileContentFileSystemException - if an error occurs.public 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 OutputStream getOutputStream() throws FileSystemException
getOutputStream in interface FileContentFileSystemException - if an error occurs.public 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 Closeableclose in interface AutoCloseableclose in interface FileContentFileSystemException - if an error occurs.public boolean isOpen()
This checks only the scope of the current thread.
isOpen in interface FileContentpublic boolean isOpenGlobal()
public FileContentInfo getContentInfo() throws FileSystemException
getContentInfo in interface FileContentFileSystemException - if an error occurs.public long write(FileContent fileContent) throws IOException
write in interface FileContentfileContent - The target FileContent.IOException - if an error occurs writing the content.public long write(FileObject file) throws IOException
write in interface FileContentfile - The target FileObject.IOException - if an error occurs writing the content.public long write(OutputStream output) throws IOException
write in interface FileContentoutput - The target OutputStream.IOException - if an error occurs writing the content.public long write(OutputStream output, int bufferSize) throws IOException
write in interface FileContentoutput - The target OutputStream.bufferSize - The buffer size to write data chunks.IOException - if an error occurs writing the file.Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.