Interface FormatFilter

All Known Implementing Classes:
BrandedPreviewJPEGFilter, ImageMagickImageThumbnailFilter, ImageMagickPdfThumbnailFilter, ImageMagickThumbnailFilter, ImageMagickVideoThumbnailFilter, JPEGFilter, MediaFilter, PDFBoxThumbnail, TikaTextExtractionFilter

public interface FormatFilter
Public interface for any class which transforms or converts content/bitstreams from one format to another. This interface should be implemented by any class which defines a "filter" to be run by the MediaFilterManager.
  • Method Details

    • getFilteredName

      String getFilteredName(String sourceName)
      Get a filename for a newly created filtered bitstream
      Parameters:
      sourceName - name of source bitstream
      Returns:
      filename generated by the filter - for example, document.pdf becomes document.pdf.txt
    • getBundleName

      String getBundleName()
      Returns:
      name of the bundle this filter will stick its generated Bitstreams
    • getFormatString

      String getFormatString()
      Returns:
      name of the bitstream format (say "HTML" or "Microsoft Word") returned by this filter look in the bitstream format registry or mediafilter.cfg for valid format strings.
    • getDescription

      String getDescription()
      Returns:
      string to describe the newly-generated Bitstream - how it was produced is a good idea
    • getDestinationStream

      InputStream getDestinationStream(Item item, InputStream source, boolean verbose) throws Exception
      Read the source stream and produce the filtered content.
      Parameters:
      item - Item
      source - input stream
      verbose - verbosity flag
      Returns:
      result of filter's transformation as a byte stream.
      Throws:
      Exception - if error
    • preProcessBitstream

      boolean preProcessBitstream(Context c, Item item, Bitstream source, boolean verbose) throws Exception
      Perform any pre-processing of the source bitstream *before* the actual filtering takes place in MediaFilterManager.processBitstream().

      Return true if pre-processing is successful (or no pre-processing is necessary). Return false if bitstream should be skipped for any reason.

      Parameters:
      c - context
      item - item containing bitstream to process
      source - source bitstream to be processed
      verbose - verbose mode
      Returns:
      true if bitstream processing should continue, false if this bitstream should be skipped
      Throws:
      Exception - if error
    • postProcessBitstream

      void postProcessBitstream(Context c, Item item, Bitstream generatedBitstream) throws Exception
      Perform any post-processing of the generated bitstream *after* this filter has already been run.

      Return true if pre-processing is successful (or no pre-processing is necessary). Return false if bitstream should be skipped for some reason.

      Parameters:
      c - context
      item - item containing bitstream to process
      generatedBitstream - the bitstream which was generated by this filter.
      Throws:
      Exception - if error