public class FileContentItem extends FileContentEntity implements ContentItem
Constructor and Description |
---|
FileContentItem(ContentLocation parent,
java.io.File backend)
Creates a new file based content item for the given file and parent location.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getInputStream()
Tries to open and return a input stream for reading from the content item.
|
java.lang.String |
getMimeType()
Returns the mime type for the content entity.
|
java.io.OutputStream |
getOutputStream()
Tries to open and return a output stream for writing into the content item.
|
boolean |
isReadable()
Checks, whether the content item is readable.
|
boolean |
isWriteable()
Checks, whether the content item is writable.
|
delete, getAttribute, getContentId, getName, getParent, getRepository, setAttribute
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
delete, getAttribute, getContentId, getName, getParent, getRepository, setAttribute
public FileContentItem(ContentLocation parent, java.io.File backend)
parent
- the parent.backend
- the backend.public java.lang.String getMimeType() throws ContentIOException
ContentItem
getMimeType
in interface ContentItem
ContentIOException
- if an error occured.public java.io.OutputStream getOutputStream() throws ContentIOException, java.io.IOException
ContentItem
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.
getOutputStream
in interface ContentItem
ContentIOException
- if an repository related error prevents the creation of the output stream.java.io.IOException
- if an IO error occurs.public java.io.InputStream getInputStream() throws ContentIOException, java.io.IOException
ContentItem
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.
getInputStream
in interface ContentItem
ContentIOException
- if an repository related error prevents the creation of the input stream.java.io.IOException
- if an IO error occurs.public boolean isReadable()
ContentItem
isReadable
in interface ContentItem
public boolean isWriteable()
ContentItem
isWriteable
in interface ContentItem