Module org.sejda.core.writer
Package org.sejda.core.writer.model
Interface ImageWriter<T extends PdfToImageParameters>
- Type Parameters:
T-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
JpegImageWriter,PngImageWriter,TiffMultiImageWriter,TiffSingleImageWriter
Interface for a writer capable of writing
RenderedImage. A writer implementation is a statefull component which may or may not support write of multiple images on a
single image file. The writer has a lifecycle where a destination is first open, images written and the destination is closed. A writer is Closeable and once closed it
should not be reused, it's behavior is unpredictable once it's closed.
The writer is meant to be used in the context of a Sejda task and its lifecycle methods have a task parameter instance as parameter to allow the writer to perform adjustments depending on the parameters specified.
- Author:
- Andrea Vacondio
-
Method Summary
Modifier and TypeMethodDescriptionvoidClose the previously opened destination.voidopenDestination(File destination, T params) Open the provided destination where image/s will be written to.booleanvoidwrite(RenderedImage image, T params) Writes the given image to the previously opened destination.
-
Method Details
-
openDestination
Open the provided destination where image/s will be written to. This method must be called beforewrite(RenderedImage, PdfToImageParameters)in order to be able to write images.- Parameters:
destination- file where the image/s will be written.params- task parameter instance.- Throws:
TaskIOException
-
closeDestination
Close the previously opened destination.- Throws:
TaskIOException
-
write
Writes the given image to the previously opened destination.- Parameters:
image- image to write.params- task parameter instance.- Throws:
TaskIOException
-
supportMultiImage
boolean supportMultiImage()- Returns:
- true if the writer can write multiple images into the same image file. If a writer supports multiple images the write method ca be called multiple times once the write destination is opened.
-