Class 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>
    A ThumbnailTask which holds an ImageSource from which the image is read or retrieved, and an ImageSink to which the thumbnail is stored or written.

    This class will take care of handing off information from the ImageSource to the ImageSink. For example, the output format that should be used by the ImageSink will be handed off if the ThumbnailParameter.ORIGINAL_FORMAT parameter is set.

    • Field Detail

      • source

        private final ImageSource<S> source
        The source from which the image is retrieved or read.
      • destination

        private final ImageSink<D> destination
        The destination to which the thumbnail is stored or written.
    • Constructor Detail

      • SourceSinkThumbnailTask

        public SourceSinkThumbnailTask​(ThumbnailParameter param,
                                       ImageSource<S> source,
                                       ImageSink<D> destination)
        Creates a ThumbnailTask in which an image is retrived from the specified ImageSource and written to the specified ImageSink, using the parameters provided in the specified ThumbnailParameter.
        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, ImageSource or ImageSink is null.
    • Method Detail

      • read

        public java.awt.image.BufferedImage read()
                                          throws java.io.IOException
        Description copied from class: ThumbnailTask
        Reads a source image.
        Specified by:
        read in class ThumbnailTask<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.IOException
        Description copied from class: ThumbnailTask
        Writes the thumbnail to the destination.
        Specified by:
        write in class ThumbnailTask<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: ThumbnailTask
        Returns the source from which the source image is retrieved or read.
        Specified by:
        getSource in class ThumbnailTask<S,​D>
        Returns:
        The source.
      • getDestination

        public D getDestination()
        Description copied from class: ThumbnailTask
        Returns the destination to which the thumbnail is stored or written.
        Specified by:
        getDestination in class ThumbnailTask<S,​D>
        Returns:
        The destination.