Skip to content

IFilterProvider interface

Description

⚠ This is deprecated. It is provided for backwards compatibility. Use Document filtering instead.

com.funnelback.common.filter.IFilterProvider interface

/**
 * <p>Determines the type of an input document.</p>
 *
 * <p>This might be an extension, MIME type or something else. It should be a
 * document type useful in the call to {@link #getOutputDocumentTypeForInputDocumentType},
 * {@link #filterFile} or {@link #filterStream}.</p>
 *
 * <p>Currently most filters use document extension (suffix) as the primary
 * means of determining this. Inherit from AbstractFilterProvider if you
 * wish to use the same type determination strategy.</p>
 */
String determineDocumentType(String inputPathOrURL) throws Exception;

/**
 * <p>Determines whether or not this filter provider is capable of filtering
 * the given document type, and determines the document type that it will
 * filter to.</p>
 *
 * @return The output document type, or null if this provider cannot filter
 *         the document.
 */
String getOutputDocumentTypeForInputDocumentType(String documentType);

/**
 * <p>Filters a file according to the extension given in documentType.</p>
 *
 * <p>Reads from `input`, Writes to `output`. Returns true if the file was
 * successfully filtered, false otherwise. This may behave differently to
 * filterStream below since it may support file-system specific behaviour
 * (such as looking for `.fun.txt` files).</p>
 */
boolean filterFile(File input, File output, String documentType) throws Exception;

boolean filterFile(File input, File output, String documentType, String url) throws Exception;

boolean filterFile(File input, File output, String documentType, String url, File originalFile) throws Exception;

/**
 * <p>Filters a stream according to the extension `given in documentType`.</p>
 *
 * <p>Reads from `input`, Writes to `output`. Returns true if the stream was
 * successfully filtered, false otherwise.</p>
 */
boolean filterStream(InputStream input, OutputStream output, String documentType) throws Exception;

boolean filterStream(InputStream input, OutputStream output, String documentType, String url) throws Exception;

boolean filterStream(InputStream input, OutputStream output, String documentType, String url, File originalFile)
		throws Exception;

See also:

top

Funnelback logo
v15.16.0