Package org.dspace.app.mediafilter
Interface FormatFilter
-
- All Known Implementing Classes:
BrandedPreviewJPEGFilter,ExcelFilter,HTMLFilter,ImageMagickImageThumbnailFilter,ImageMagickPdfThumbnailFilter,ImageMagickThumbnailFilter,JPEGFilter,MediaFilter,PDFBoxThumbnail,PDFFilter,PoiWordFilter,PowerPointFilter
public interface FormatFilterPublic 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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetBundleName()StringgetDescription()InputStreamgetDestinationStream(Item item, InputStream source, boolean verbose)Read the source stream and produce the filtered content.StringgetFilteredName(String sourceName)Get a filename for a newly created filtered bitstreamStringgetFormatString()voidpostProcessBitstream(Context c, Item item, Bitstream generatedBitstream)Perform any post-processing of the generated bitstream *after* this filter has already been run.booleanpreProcessBitstream(Context c, Item item, Bitstream source, boolean verbose)Perform any pre-processing of the source bitstream *before* the actual filtering takes place in MediaFilterManager.processBitstream().
-
-
-
Method Detail
-
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- Itemsource- input streamverbose- 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- contextitem- item containing bitstream to processsource- source bitstream to be processedverbose- 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- contextitem- item containing bitstream to processgeneratedBitstream- the bitstream which was generated by this filter.- Throws:
Exception- if error
-
-