Class BufferedImageSink

  • All Implemented Interfaces:
    ImageSink<java.awt.image.BufferedImage>

    public class BufferedImageSink
    extends AbstractImageSink<java.awt.image.BufferedImage>
    An ImageSink which stores the resulting thumbnail to a BufferedImage.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.image.BufferedImage img
      The BufferedImage which holds the thumbnail.
      private boolean written
      Indicates whether the thumbnail has been written to this object.
    • Field Detail

      • img

        private java.awt.image.BufferedImage img
        The BufferedImage which holds the thumbnail.
      • written

        private boolean written
        Indicates whether the thumbnail has been written to this object.
    • Constructor Detail

      • BufferedImageSink

        public BufferedImageSink()
    • Method Detail

      • write

        public void write​(java.awt.image.BufferedImage img)
                   throws java.io.IOException
        Description copied from interface: ImageSink
        Writes the resulting image to a destination.
        Specified by:
        write in interface ImageSink<java.awt.image.BufferedImage>
        Overrides:
        write in class AbstractImageSink<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 this BufferedImageSink yet.
      • setOutputFormatName

        public void setOutputFormatName​(java.lang.String format)
        Description copied from interface: ImageSink
        Sets 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:
        setOutputFormatName in interface ImageSink<java.awt.image.BufferedImage>
        Overrides:
        setOutputFormatName in class AbstractImageSink<java.awt.image.BufferedImage>
        Parameters:
        format - File format with which to store the image.