Package net.coobird.thumbnailator.tasks
Class SourceSinkThumbnailTask<S,D>
- java.lang.Object
-
- net.coobird.thumbnailator.tasks.ThumbnailTask<S,D>
-
- net.coobird.thumbnailator.tasks.SourceSinkThumbnailTask<S,D>
-
- Type Parameters:
S- The source class from which the source image is retrieved or read.D- The destination class to which the thumbnail is stored or written.
public class SourceSinkThumbnailTask<S,D> extends ThumbnailTask<S,D>
AThumbnailTaskwhich holds anImageSourcefrom which the image is read or retrieved, and anImageSinkto which the thumbnail is stored or written.This class will take care of handing off information from the
ImageSourceto theImageSink. For example, the output format that should be used by theImageSinkwill be handed off if theThumbnailParameter.ORIGINAL_FORMATparameter is set.
-
-
Field Summary
Fields Modifier and Type Field Description private ImageSink<D>destinationThe destination to which the thumbnail is stored or written.private ImageSource<S>sourceThe source from which the image is retrieved or read.-
Fields inherited from class net.coobird.thumbnailator.tasks.ThumbnailTask
FIRST_IMAGE_INDEX, inputFormatName, param
-
-
Constructor Summary
Constructors Constructor Description SourceSinkThumbnailTask(ThumbnailParameter param, ImageSource<S> source, ImageSink<D> destination)Creates aThumbnailTaskin which an image is retrived from the specifiedImageSourceand written to the specifiedImageSink, using the parameters provided in the specifiedThumbnailParameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DgetDestination()Returns the destination to which the thumbnail is stored or written.SgetSource()Returns the source from which the source image is retrieved or read.java.awt.image.BufferedImageread()Reads a source image.voidwrite(java.awt.image.BufferedImage img)Writes the thumbnail to the destination.-
Methods inherited from class net.coobird.thumbnailator.tasks.ThumbnailTask
getParam
-
-
-
-
Field Detail
-
source
private final ImageSource<S> source
The source from which the image is retrieved or read.
-
-
Constructor Detail
-
SourceSinkThumbnailTask
public SourceSinkThumbnailTask(ThumbnailParameter param, ImageSource<S> source, ImageSink<D> destination)
Creates aThumbnailTaskin which an image is retrived from the specifiedImageSourceand written to the specifiedImageSink, using the parameters provided in the specifiedThumbnailParameter.- Parameters:
param- The parameters to use to create the thumbnail.source- The source from which the image is retrieved or read from.destination- The destination to which the thumbnail is stored or written to.- Throws:
java.lang.NullPointerException- If either the parameter,ImageSourceorImageSinkisnull.
-
-
Method Detail
-
read
public java.awt.image.BufferedImage read() throws java.io.IOExceptionDescription copied from class:ThumbnailTaskReads a source image.- Specified by:
readin classThumbnailTask<S,D>- Returns:
- The image which was obtained from the source.
- Throws:
java.io.IOException- Thrown when an I/O problem occurs when reading from the image source.
-
write
public void write(java.awt.image.BufferedImage img) throws java.io.IOExceptionDescription copied from class:ThumbnailTaskWrites the thumbnail to the destination.- Specified by:
writein classThumbnailTask<S,D>- Parameters:
img- The image to write.- Throws:
UnsupportedFormatException- When an image file which is to be read or written is unsupported.java.io.IOException- Thrown when an I/O problem occurs when writing the image.
-
getSource
public S getSource()
Description copied from class:ThumbnailTaskReturns the source from which the source image is retrieved or read.- Specified by:
getSourcein classThumbnailTask<S,D>- Returns:
- The source.
-
getDestination
public D getDestination()
Description copied from class:ThumbnailTaskReturns the destination to which the thumbnail is stored or written.- Specified by:
getDestinationin classThumbnailTask<S,D>- Returns:
- The destination.
-
-