net.coobird.thumbnailator.tasks.io
Class FileImageSource

java.lang.Object
  extended by net.coobird.thumbnailator.tasks.io.AbstractImageSource<File>
      extended by net.coobird.thumbnailator.tasks.io.FileImageSource
All Implemented Interfaces:
ImageSource<File>

public class FileImageSource
extends AbstractImageSource<File>

An ImageSource which reads the source image from a file.

Author:
coobird

Constructor Summary
FileImageSource(File sourceFile)
          Instantiates a FileImageSource with the specified file as the source image.
FileImageSource(String sourceFilePath)
          Instantiates a FileImageSource with the specified file as the source image.
 
Method Summary
 File getSource()
          Returns the source file from which an image is read.
 BufferedImage read()
          Retrieves the image from the source.
 
Methods inherited from class net.coobird.thumbnailator.tasks.io.AbstractImageSource
getInputFormatName, setThumbnailParameter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileImageSource

public FileImageSource(File sourceFile)
Instantiates a FileImageSource with the specified file as the source image.

Parameters:
sourceFile - The source image file.
Throws:
NullPointerException - If the image is null.

FileImageSource

public FileImageSource(String sourceFilePath)
Instantiates a FileImageSource with the specified file as the source image.

Parameters:
sourceFilePath - The filepath of the source image file.
Throws:
NullPointerException - If the image is null.
Method Detail

read

public BufferedImage read()
                   throws IOException
Description copied from interface: ImageSource
Retrieves the image from the source.

Returns:
The image.
Throws:
IOException - When a problem occurs while reading or obtaining the image.

getSource

public File getSource()
Returns the source file from which an image is read.

Returns:
The File representation of the source file.


Copyright © 2014. All rights reserved.