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 Details

    • 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 interface IMimeTypeListener
      Parameters:
      mimeType - The mime type to set.