Class StreamThumbnailTask


  • public class StreamThumbnailTask
    extends ThumbnailTask<java.io.InputStream,​java.io.OutputStream>
    A thumbnail generation task which streams data from an InputStream to an OutputStream.

    This class does not close the InputStream and OutputStream upon the completion of processing.

    Only the first image obtained from the data stream will be read. Subsequent images will be ignored.

    • Constructor Detail

      • StreamThumbnailTask

        public StreamThumbnailTask​(ThumbnailParameter param,
                                   java.io.InputStream is,
                                   java.io.OutputStream os)
        Creates a ThumbnailTask in which streamed image data from the specified InputStream is output to a specified OutputStream, using the parameters provided in the specified ThumbnailParameter.
        Parameters:
        param - The parameters to use to create the thumbnail.
        is - The InputStream from which to obtain image data.
        os - The OutputStream to send thumbnail data to.
        Throws:
        java.lang.NullPointerException - If the parameter 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<java.io.InputStream,​java.io.OutputStream>
        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<java.io.InputStream,​java.io.OutputStream>
        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 java.io.InputStream getSource()
        Description copied from class: ThumbnailTask
        Returns the source from which the source image is retrieved or read.
        Specified by:
        getSource in class ThumbnailTask<java.io.InputStream,​java.io.OutputStream>
        Returns:
        The source.
      • getDestination

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