Class AbstractImageSink<T>
- java.lang.Object
-
- net.coobird.thumbnailator.tasks.io.AbstractImageSink<T>
-
- All Implemented Interfaces:
ImageSink<T>
- Direct Known Subclasses:
BufferedImageSink,FileImageSink.UninitializedImageSink,OutputStreamImageSink
public abstract class AbstractImageSink<T> extends java.lang.Object implements ImageSink<T>
An abstract class forImageSinks.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringoutputFormatThe name of the format to output the image as.protected ThumbnailParameterparamThe parameters that should be used when storing the image.
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractImageSink()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringpreferredOutputFormatName()Returns the output format to use from information provided for the output image.voidsetOutputFormatName(java.lang.String format)Sets the output format of the resulting image.voidsetThumbnailParameter(ThumbnailParameter param)Sets theThumbnailParameterfrom which to retrieve parameters to use when storing the image.voidwrite(java.awt.image.BufferedImage img)Writes the resulting image to a destination.
-
-
-
Field Detail
-
outputFormat
protected java.lang.String outputFormat
The name of the format to output the image as.
-
param
protected ThumbnailParameter param
The parameters that should be used when storing the image.
-
-
Method Detail
-
setOutputFormatName
public void setOutputFormatName(java.lang.String format)
Description copied from interface:ImageSinkSets the output format of the resulting image.For
ImageSinks which stores raw images, the format name specified by this method may be ignored.- Specified by:
setOutputFormatNamein interfaceImageSink<T>- Parameters:
format- File format with which to store the image.
-
setThumbnailParameter
public void setThumbnailParameter(ThumbnailParameter param)
Description copied from interface:ImageSinkSets theThumbnailParameterfrom which to retrieve parameters to use when storing the image.- Specified by:
setThumbnailParameterin interfaceImageSink<T>- Parameters:
param- TheThumbnailParameterwith image writing parameters.
-
write
public void write(java.awt.image.BufferedImage img) throws java.io.IOExceptionDescription copied from interface:ImageSinkWrites the resulting image to a destination.
-
preferredOutputFormatName
public java.lang.String preferredOutputFormatName()
Description copied from interface:ImageSinkReturns the output format to use from information provided for the output image.
If the output format cannot be determined, then
ThumbnailParameter.ORIGINAL_FORMATshould be returned.- Specified by:
preferredOutputFormatNamein interfaceImageSink<T>- Returns:
- Name of the preferred output format.
-
-