Package com.documents4j.api
Interface IConverter
-
public interface IConverterA converter that allows the conversion of documents. A converter might have an active life cycle such that itsshutDown()method must be called when a converter is not longer used. After a converter is shut down, it cannot be reused but needs to be recreated.
-
-
Field Summary
Fields Modifier and Type Field Description static intJOB_PRIORITY_HIGHA conversion of high priority.static intJOB_PRIORITY_LOWA conversion of low priority.static intJOB_PRIORITY_NORMALA conversion of normal priority.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IConversionJobWithSourceUnspecifiedconvert(IFileSource source)Invokes a callback for the dynamic generation of a file source which is additionally informed about the consumption of a source.IConversionJobWithSourceUnspecifiedconvert(IInputStreamSource source)Invokes a callback for the dynamic generation of a input stream source which is additionally informed about the consumption of this source.IConversionJobWithSourceUnspecifiedconvert(File source)Converts a source file that is stored on the local file system.IConversionJobWithSourceUnspecifiedconvert(InputStream source)Converts a source that is represented as aInputStream.IConversionJobWithSourceUnspecifiedconvert(InputStream source, boolean close)Converts a source that is represented as aInputStream.Map<DocumentType,Set<DocumentType>>getSupportedConversions()Returns a mapping of all conversions that are supported by the backing conversion engine.booleanisOperational()Checks if this converter is currently operational, i.e.voidkill()Shuts down this converter immediately.voidshutDown()Shuts down this converter gracefully.
-
-
-
Field Detail
-
JOB_PRIORITY_LOW
static final int JOB_PRIORITY_LOW
A conversion of low priority. Recommended for longer lasting batch conversion such that a converter does not block until the batch conversion terminates.- See Also:
- Constant Field Values
-
JOB_PRIORITY_NORMAL
static final int JOB_PRIORITY_NORMAL
A conversion of normal priority. Recommended for non-urgent conversions that are not requested just-in-time.- See Also:
- Constant Field Values
-
JOB_PRIORITY_HIGH
static final int JOB_PRIORITY_HIGH
A conversion of high priority. Recommended for just-in-time conversions.- See Also:
- Constant Field Values
-
-
Method Detail
-
convert
IConversionJobWithSourceUnspecified convert(InputStream source)
Converts a source that is represented as aInputStream. The input stream will be closed after the conversion is complete.- Parameters:
source- The conversion input as an input stream.- Returns:
- The current conversion specification.
-
convert
IConversionJobWithSourceUnspecified convert(InputStream source, boolean close)
Converts a source that is represented as aInputStream.- Parameters:
source- The conversion input as an input stream.close- Whether theInputStreamis closed after the conversion terminates.- Returns:
- The current conversion specification.
-
convert
IConversionJobWithSourceUnspecified convert(IInputStreamSource source)
Invokes a callback for the dynamic generation of a input stream source which is additionally informed about the consumption of this source.- Parameters:
source- The input stream source generator.- Returns:
- The current conversion specification.
-
convert
IConversionJobWithSourceUnspecified convert(File source)
Converts a source file that is stored on the local file system.- Parameters:
source- The conversion input as a file.- Returns:
- The current conversion specification.
-
convert
IConversionJobWithSourceUnspecified convert(IFileSource source)
Invokes a callback for the dynamic generation of a file source which is additionally informed about the consumption of a source.- Parameters:
source- The file source generator.- Returns:
- The current conversion specification.
-
getSupportedConversions
Map<DocumentType,Set<DocumentType>> getSupportedConversions()
Returns a mapping of all conversions that are supported by the backing conversion engine.- Returns:
- A map of all possible conversions with the key describing the input types and the set describing the formats that these input types can be converted into.
-
isOperational
boolean isOperational()
Checks if this converter is currently operational, i.e. it can convert documents and is not shut down.- Returns:
trueif the converter is operational.
-
shutDown
void shutDown()
Shuts down this converter gracefully. The converter does no longer accept new conversion requests but awaits running conversions to complete for a given period of time.
-
kill
void kill()
Shuts down this converter immediately. All running conversions are aborted.
-
-