Class InputStreamImageSource

  • All Implemented Interfaces:
    ImageSource<java.io.InputStream>

    public class InputStreamImageSource
    extends AbstractImageSource<java.io.InputStream>
    An ImageSource which uses an InputStream to read the source image.
    • Field Detail

      • FIRST_IMAGE_INDEX

        private static final int FIRST_IMAGE_INDEX
        The index used to obtain the first image in an image file.
        See Also:
        Constant Field Values
      • is

        private java.io.InputStream is
        A InputStream from which the source image is to be read.
    • Constructor Detail

      • InputStreamImageSource

        public InputStreamImageSource​(java.io.InputStream is)
        Instantiates an InputStreamImageSource with the InputStream which will be used to read the source image.
        Parameters:
        is - The InputStream which is to be used to obtain the source image.
        Throws:
        java.lang.NullPointerException - If the InputStream is null.
    • Method Detail

      • read

        public java.awt.image.BufferedImage read()
                                          throws java.io.IOException
        Description copied from interface: ImageSource
        Retrieves the image from the source.
        Returns:
        The image.
        Throws:
        java.io.IOException - When a problem occurs while reading or obtaining the image.
      • readImage

        private java.awt.image.BufferedImage readImage​(javax.imageio.ImageReader reader)
                                                throws java.io.IOException
        Throws:
        java.io.IOException
      • calculateSourceRegion

        private java.awt.Rectangle calculateSourceRegion​(int width,
                                                         int height,
                                                         Orientation orientation,
                                                         Region region)
      • getSource

        public java.io.InputStream getSource()
        Description copied from interface: ImageSource
        Returns the source from which the image is read or retrieved.
        Returns:
        The source of the image.