Interface IContentItem
-
- All Superinterfaces:
IMimeTypeListener
public interface IContentItem extends IMimeTypeListener
Construction of a new ContentItem is managed by ContentLocation.newContentItem. This is because there is a parent-child relationship between ContentLocations and content items. To avoid having a content item reach back into it's parent to add itself to the children list, you instead call the content location to construct a content item. A content item cannot exist without a content location.- Author:
- mbatchel
- See Also:
ContentLocation
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
closeOutputStream()
org.pentaho.commons.connection.IPentahoStreamSource
getDataSource()
InputStream
getInputStream()
Gets an input stream from the Content item.String
getMimeType()
OutputStream
getOutputStream(String actionName)
The behavior of this method depends upon it's write mode (defined only at construction).String
getPath()
void
setMimeType(String mimeType)
Sets the mime type-
Methods inherited from interface org.pentaho.platform.api.engine.IMimeTypeListener
setName
-
-
-
-
Method Detail
-
getPath
String getPath()
- Returns:
- The ContentItem path
-
getMimeType
String getMimeType()
- Returns:
- The MimeType of the content item.
-
getInputStream
InputStream getInputStream() throws ContentException
Gets an input stream from the Content item. If the content item doesn't exist on disk, throws an exception- Returns:
- An input stream from the file system that is represented by this content item
- Throws:
ContentException
-
getDataSource
org.pentaho.commons.connection.IPentahoStreamSource getDataSource()
-
getOutputStream
OutputStream getOutputStream(String actionName) throws IOException
The behavior of this method depends upon it's write mode (defined only at construction). If the write mode is WRITEMODE_KEEPVERSIONS, this method will create a new file on the disk, and add it to it's internal list of files, and return an output stream. If the write mode is WRITEMODE_OVERWRITE, this method will create an output stream and overwrite the existing file on the disk if it's found, or will create the file if it doesn't exist. If the write mode is WRITEMODE_APPEND, this method will append to the existing file on disk (if it exists), or create it if it doesn't exist.- Parameters:
actionName
- The name of the action that is obtaining the output stream.- Returns:
- the OutputStream to write to
- Throws:
IOException
-
closeOutputStream
void closeOutputStream()
-
setMimeType
void setMimeType(String mimeType)
Sets the mime type- Specified by:
setMimeType
in interfaceIMimeTypeListener
- Parameters:
mimeType
- The mime type to set.
-
-