Class FileThumbnailTask


  • public class FileThumbnailTask
    extends ThumbnailTask<java.io.File,​java.io.File>
    A thumbnail generation task which reads and writes data from and to a File.

    Only the first image included in the image file will be read. Subsequent images included in the image file will be ignored.

    • Constructor Detail

      • FileThumbnailTask

        public FileThumbnailTask​(ThumbnailParameter param,
                                 java.io.File sourceFile,
                                 java.io.File destinationFile)
        Creates a ThumbnailTask in which image data is read from the specified File and is output to a specified File, using the parameters provided in the specified ThumbnailParameter.
        Parameters:
        param - The parameters to use to create the thumbnail.
        sourceFile - The File from which image data is read.
        destinationFile - The File to which thumbnail is written.
        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.File,​java.io.File>
        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.File,​java.io.File>
        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.File 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.File,​java.io.File>
        Returns:
        The source.
      • getDestination

        public java.io.File 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.File,​java.io.File>
        Returns:
        The destination.