Class FileImageSource

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

    public class FileImageSource
    extends java.lang.Object
    implements ImageSource<java.io.File>
    An ImageSource which reads the source image from a file.
    • Constructor Detail

      • FileImageSource

        public FileImageSource​(java.io.File sourceFile)
        Instantiates a FileImageSource with the specified file as the source image.
        Parameters:
        sourceFile - The source image file.
        Throws:
        java.lang.NullPointerException - If the image is null.
      • FileImageSource

        public FileImageSource​(java.lang.String sourceFilePath)
        Instantiates a FileImageSource with the specified file as the source image.
        Parameters:
        sourceFilePath - The filepath of the source image file.
        Throws:
        java.lang.NullPointerException - If the image 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.
        Specified by:
        read in interface ImageSource<java.io.File>
        Returns:
        The image.
        Throws:
        java.io.IOException - When a problem occurs while reading or obtaining the image.
      • getSource

        public java.io.File getSource()
        Returns the source file from which an image is read.
        Specified by:
        getSource in interface ImageSource<java.io.File>
        Returns:
        The File representation of the source file.
      • getInputFormatName

        public java.lang.String getInputFormatName()
        Description copied from interface: ImageSource
        Returns the name of the image format.
        Specified by:
        getInputFormatName in interface ImageSource<java.io.File>
        Returns:
        The image format name. If there is no image format information, then null will be returned.