Interface OutputItem
An OutputItem
contains a partial result of a conversion and meta information.
This meta information includes the item number, the total number or items and the file extension.
A Callback
can be set to be called after a partial result is completed.
OutputItem
s are available when using PDFreactor.convert(Configuration, OutputStreamProvider)
.
For each partial result an OutputItem
is created.
It contains a partial result of the conversion, such as a single image of a multiple images Configuration.OutputFormat
.
The OutputItem
can be accessed via the provided OutputStreamProvider.provide(OutputItem)
function.
For more information please have a look at the PDFreactor manual.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the file extension according to theConfiguration.OutputFormat
.getGroup()
Returns the group to which this item belongs.int
getIndex()
Returns the index of the item.int
Returns the total number of items of the conversion result within a specific group.int
Returns the item number of theOutputItem
.Returns theOutputStream
that belongs to theOutputItem
.Same asgetItemNumber()
, but the result is automatically padded according to the total number of items.getPaddedItemNumber
(int padding) Same asgetItemNumber()
, but the result is padded.boolean
Returns whether theOutputStream
is closed after the partial result has been written.void
setCallback
(Callback callback) Sets aCallback.call(OutputItem)
function which is called by PDFreactor after a partial result has been finished.void
setKeepOpen
(boolean value) Sets whether theOutputStream
to be closed after the partial result has been written.
-
Method Details
-
getOutputStream
OutputStream getOutputStream()Returns the
OutputStream
that belongs to theOutputItem
. -
getIndex
int getIndex()Returns the index of the item. Starts at 0 and is incremented for each subsequent item, independent of the
getItemNumber()
,getGroup()
, orgetItemCount()
, meaning each item will have a unique index.- Returns:
- The index of the partial result.
-
getFileExtension
String getFileExtension()Returns the file extension according to the
Configuration.OutputFormat
.It is set automatically by PDFreactor during conversion.
- Returns:
- The file extension of the the partial result.
-
getPaddedItemNumber
Same as
getItemNumber()
, but the result is padded. The padding parameter specifies how many digits should be padded with '0'.For example, this method returns '001' for the first item if padding is set to 2.
- Parameters:
padding
- Number of digits to be padded with '0'.- Returns:
- The item number of the the partial result.
-
getPaddedItemNumber
String getPaddedItemNumber()Same as
getItemNumber()
, but the result is automatically padded according to the total number of items.- Returns:
- The item number of the the partial result.
-
getItemNumber
int getItemNumber()Returns the item number of the
OutputItem
. For multi-image conversions, the item number is equivalent to the page number.The item number in combination with the
getGroup()
represent a unique identifier for this item.- Returns:
- The item number of the the partial result.
-
getItemCount
int getItemCount()Returns the total number of items of the conversion result within a specific group.
- Returns:
- The total number of items of the conversion result.
- See Also:
-
setKeepOpen
void setKeepOpen(boolean value) Sets whether the
OutputStream
to be closed after the partial result has been written.Default value is 'false'
- Parameters:
value
- Whether the providedOutputStream
should be closed after the partial result has been written.
-
isKeepOpen
boolean isKeepOpen()Returns whether the
OutputStream
is closed after the partial result has been written.- Returns:
- Whether the
OutputStream
is closed after the partial result has been written.
-
setCallback
Sets a
Callback.call(OutputItem)
function which is called by PDFreactor after a partial result has been finished.- Parameters:
callback
- TheCallback
function which is called after the partial result has been written.
-
getGroup
OutputItemGroup getGroup()Returns the group to which this item belongs.
The group in combination with the
getItemNumber()
represent a unique identifier for this item.- Returns:
- The
OutputItemGroup
.
-