Class BufferedImageSink
- java.lang.Object
-
- net.coobird.thumbnailator.tasks.io.AbstractImageSink<java.awt.image.BufferedImage>
-
- net.coobird.thumbnailator.tasks.io.BufferedImageSink
-
- All Implemented Interfaces:
ImageSink<java.awt.image.BufferedImage>
public class BufferedImageSink extends AbstractImageSink<java.awt.image.BufferedImage>
AnImageSinkwhich stores the resulting thumbnail to aBufferedImage.
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.image.BufferedImageimgTheBufferedImagewhich holds the thumbnail.private booleanwrittenIndicates whether the thumbnail has been written to this object.-
Fields inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSink
outputFormat, param
-
-
Constructor Summary
Constructors Constructor Description BufferedImageSink()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.image.BufferedImagegetSink()Returns the thumbnail.voidsetOutputFormatName(java.lang.String format)Sets the output format of the resulting image.voidwrite(java.awt.image.BufferedImage img)Writes the resulting image to a destination.-
Methods inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSink
preferredOutputFormatName, setThumbnailParameter
-
-
-
-
Method Detail
-
write
public void write(java.awt.image.BufferedImage img) throws java.io.IOExceptionDescription copied from interface:ImageSinkWrites the resulting image to a destination.- Specified by:
writein interfaceImageSink<java.awt.image.BufferedImage>- Overrides:
writein classAbstractImageSink<java.awt.image.BufferedImage>- Parameters:
img- The image to write or store.- Throws:
java.io.IOException- When a problem occurs while writing or storing the image.
-
getSink
public java.awt.image.BufferedImage getSink()
Returns the thumbnail.- Returns:
- The thumbnail.
- Throws:
java.lang.IllegalStateException- If a thumbnail has not been stored to thisBufferedImageSinkyet.
-
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<java.awt.image.BufferedImage>- Overrides:
setOutputFormatNamein classAbstractImageSink<java.awt.image.BufferedImage>- Parameters:
format- File format with which to store the image.
-
-