Class FileContentItem
java.lang.Object
org.pentaho.reporting.libraries.repository.file.FileContentEntity
org.pentaho.reporting.libraries.repository.file.FileContentItem
- All Implemented Interfaces:
Serializable, ContentEntity, ContentItem
A content item wrapping a file.
- Author:
- Thomas Morgner
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFileContentItem(ContentLocation parent, File backend) Creates a new file based content item for the given file and parent location. -
Method Summary
Modifier and TypeMethodDescriptionTries to open and return a input stream for reading from the content item.Returns the mime type for the content entity.Tries to open and return a output stream for writing into the content item.booleanChecks, whether the content item is readable.booleanChecks, whether the content item is writable.Methods inherited from class FileContentEntity
delete, getAttribute, getContentId, getName, getParent, getRepository, setAttributeMethods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentEntity
delete, getAttribute, getContentId, getName, getParent, getRepository, setAttribute
-
Constructor Details
-
FileContentItem
Creates a new file based content item for the given file and parent location.- Parameters:
parent- the parent.backend- the backend.
-
-
Method Details
-
getMimeType
Description copied from interface:ContentItemReturns the mime type for the content entity. If the repository does not store mimetypes, this call usually uses the repositories MimeRegistry to resolve the mimetype.- Specified by:
getMimeTypein interfaceContentItem- Returns:
- the mime type.
- Throws:
ContentIOException- if an error occured.
-
getOutputStream
Description copied from interface:ContentItemTries to open and return a output stream for writing into the content item. This call will fail if the item is not writeable. Whether opening multiple output streams at the same time is possible is implementation dependent, but it is generally not recommended to try this.Having both an input and output stream open at the same time is not guaranteed to work. Generally if you need to append data, first open the inputstream and copy the content to a temporary location and then write the content along with the appended content to the new output stream.
- Specified by:
getOutputStreamin interfaceContentItem- Returns:
- the output stream for writing the item.
- Throws:
ContentIOException- if an repository related error prevents the creation of the output stream.IOException- if an IO error occurs.
-
getInputStream
Description copied from interface:ContentItemTries to open and return a input stream for reading from the content item. This call will fail if the item is not readable. Whether opening multiple input streams at the same time is possible is implementation dependent.Having both an input and output stream open at the same time is not guaranteed to work. Generally if you need to append data, first open the inputstream and copy the content to a temporary location and then write the content along with the appended content to the new output stream.
- Specified by:
getInputStreamin interfaceContentItem- Returns:
- the input stream for reading from the item.
- Throws:
ContentIOException- if an repository related error prevents the creation of the input stream.IOException- if an IO error occurs.
-
isReadable
public boolean isReadable()Description copied from interface:ContentItemChecks, whether the content item is readable. A content item that is not readable will never return a valid inputstream and any call to getInputStream is bound to fail.- Specified by:
isReadablein interfaceContentItem- Returns:
- true, if the content item is readable, false otherwise.
-
isWriteable
public boolean isWriteable()Description copied from interface:ContentItemChecks, whether the content item is writable. A content item that is not writable will never return a valid outputstream and any call to getOutputStream is bound to fail.- Specified by:
isWriteablein interfaceContentItem- Returns:
- true, if the content item is writeable, false otherwise.
-