Package org.apache.commons.imaging

# Class AbstractImageParser<T extends ImagingParameters<T>>

java.lang.Object
org.apache.commons.imaging.common.BinaryFileParser
org.apache.commons.imaging.AbstractImageParser<T>

Type Parameters:
  `T` - type of parameters used by this image parser

Direct Known Subclasses:
  `BmpImageParser`, `DcxImageParser`, `GifImageParser`, `IcnsImageParser`, `IcoImageParser`, `JpegImageParser`, `PcxImageParser`, `PngImageParser`, `PnmImageParser`, `PsdImageParser`, `RgbeImageParser`, `TiffImageParser`, `WbmpImageParser`, `WebPImageParser`, `XbmImageParser`, `XpmImageParser`

public abstract class AbstractImageParser<T extends ImagingParameters<T>> extends BinaryFileParser
Provides the abstract base class for all image reading and writing utilities. ImageParser implementations are expected to extend this class providing logic for identifying and processing data in their own specific format. Specific implementations are found under the com.apache.commons.imaging.formats package.

## Application Notes

### Format support

For the most recent information on format support for the Apache Commons Imaging package, refer to Format Support at the main project development web site.

### On the accuracy of this Javadoc

The original authors of this class did not supply documentation. The Javadoc for this class is based on inspection of the source code. In some cases, the purpose and usage for particular methods was deduced from the source and may not perfectly reflect the intentions of the original. Therefore, you should not assume that the documentation is perfect, especially in the more obscure and specialized areas of implementation.

### The "params" argument

Many of the methods specified by this class accept an argument of type `T` defining the parameters to be used when processing an image. For example, some of the output formats permit of different kinds of image compression or color models. Some of the reading methods permit the calling application to require strict format compliance.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractImageParser()`
  Constructs a new instance with the default, big-endian, byte order.
  `AbstractImageParser(ByteOrder byteOrder)`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `canAcceptExtension(File file)`
  Tests whether the ImageParser implementation can accept the specified file based on its extension.
  `final boolean`
  `canAcceptExtension(String fileName)`
  Tests whether the ImageParser implementation can accept the specified file name based on its extension.
  `boolean`
  `canAcceptType(ImageFormat imageFormat)`
  Tests whether the ImageParser implementation can accept the specified format.
  `final String`
  `dumpImageFile(byte[] bytes)`
  Writes the ImageInfo and format-specific information for the image content of the specified byte array to a string.
  `final String`
  `dumpImageFile(File file)`
  Writes the ImageInfo and format-specific information for the image content of the specified file to a string.
  `boolean`
  `dumpImageFile(PrintWriter pw, ByteSource byteSource)`
  Writes the ImageInfo and format-specific information for the image content of the specified byte source to a PrintWriter
  `final String`
  `dumpImageFile(ByteSource byteSource)`
  Writes the ImageInfo and format-specific information for the image content of the specified byte source to a string.
  `protected abstract String[]`
  `getAcceptedExtensions()`
  Gets an array of all accepted extensions
  `protected abstract ImageFormat[]`
  `getAcceptedTypes()`
  Gets an array of ImageFormat objects describing all accepted types
  `final List<BufferedImage>`
  `getAllBufferedImages(byte[] bytes)`
  Gets all images specified by the byte array (some formats may include multiple images within a single data source).
  `final List<BufferedImage>`
  `getAllBufferedImages(File file)`
  Gets all images specified by indicated file (some formats may include multiple images within a single data source).
  `List<BufferedImage>`
  `getAllBufferedImages(ByteSource byteSource)`
  Gets all images specified by the byte source (some formats may include multiple images within a single data source).
  `static List<AbstractImageParser<?>>`
  `getAllImageParsers()`
  Gets an array of new instances of all image parsers.
  `final BufferedImage`
  `getBufferedImage(byte[] bytes, T params)`
  Gets a buffered image specified by the byte array (for sources that specify multiple images, choice of which image is returned is implementation dependent).
  `final BufferedImage`
  `getBufferedImage(File file, T params)`
  Gets a buffered image specified by the indicated file (for sources that specify multiple images, choice of which image is returned is implementation dependent).
  `abstract BufferedImage`
  `getBufferedImage(ByteSource byteSource, T params)`
  Gets a buffered image specified by the byte source (for sources that specify multiple images, choice of which image is returned is implementation dependent).
  `protected BufferedImageFactory`
  `getBufferedImageFactory(T params)`
  Gets an instance of IBufferedImageFactory based on the presence of a specification for ImagingConstants..BUFFERED_IMAGE_FACTORY within the supplied params.
  `abstract String`
  `getDefaultExtension()`
  Gets the default extension for the format specified by an implementation of ImageParser.
  `abstract T`
  `getDefaultParameters()`
  Gets a default parameters instance for this parser.
  `final FormatCompliance`
  `getFormatCompliance(byte[] bytes)`
  Determines the format compliance of the content of the supplied byte array based on rules provided by a specific implementation.
  `final FormatCompliance`
  `getFormatCompliance(File file)`
  Determines the format compliance of the specified file based on rules provided by a specific implementation.
  `FormatCompliance`
  `getFormatCompliance(ByteSource byteSource)`
  Determines the format compliance of the content of the supplied byte source based on rules provided by a specific implementation.
  `final byte[]`
  `getIccProfileBytes(byte[] bytes)`
  Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input byte array.
  `final byte[]`
  `getIccProfileBytes(byte[] bytes, T params)`
  Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input byte array.
  `final byte[]`
  `getIccProfileBytes(File file)`
  Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input file.
  `final byte[]`
  `getIccProfileBytes(File file, T params)`
  Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input file.
  `abstract byte[]`
  `getIccProfileBytes(ByteSource byteSource, T params)`
  Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input byteSource.
  `final ImageInfo`
  `getImageInfo(byte[] bytes, T params)`
  Gets image information from the specified array of bytes.
  `final ImageInfo`
  `getImageInfo(File file, T params)`
  Gets image information from the specified file Format-specific ImageParser implementations are expected to return a valid ImageInfo object or to throw an ImageReadException if unable to process the specified data.
  `final ImageInfo`
  `getImageInfo(ByteSource byteSource)`
  Gets image information from the specified ByteSource.
  `abstract ImageInfo`
  `getImageInfo(ByteSource byteSource, T params)`
  Gets image information from the specified ByteSource.
  `final Dimension`
  `getImageSize(byte[] bytes)`
  Gets the size of the image described by the specified byte array.
  `final Dimension`
  `getImageSize(byte[] bytes, T params)`
  Gets the size of the image described by the specified byte array.
  `final Dimension`
  `getImageSize(File file)`
  Gets the size of the image described by the specified file.
  `final Dimension`
  `getImageSize(File file, T params)`
  Gets the size of the image described by the specified file.
  `abstract Dimension`
  `getImageSize(ByteSource byteSource, T params)`
  Gets the size of the image described by the specified ByteSource.
  `final ImageMetadata`
  `getMetadata(byte[] bytes)`
  Gets image metadata from the specified array of bytes.
  `final ImageMetadata`
  `getMetadata(byte[] bytes, T params)`
  Gets image metadata from the specified array of bytes.
  `final ImageMetadata`
  `getMetadata(File file)`
  Gets image metadata from the specified file.
  `final ImageMetadata`
  `getMetadata(File file, T params)`
  Gets image metadata from the specified file.
  `final ImageMetadata`
  `getMetadata(ByteSource byteSource)`
  Gets image metadata from the specified byte source.
  `abstract ImageMetadata`
  `getMetadata(ByteSource byteSource, T params)`
  Gets image metadata from the specified byte source.
  `abstract String`
  `getName()`
  Gets a descriptive name for the implementation of an ImageParser.
  `void`
  `writeImage(BufferedImage src, OutputStream os, T params)`
  Writes the content of a BufferedImage to the specified output stream.

  ### Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser

  `debugNumber, debugNumber, getByteOrder, setByteOrder`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AbstractImageParser

    public AbstractImageParser()
    Constructs a new instance with the default, big-endian, byte order.

  - ### AbstractImageParser

    public AbstractImageParser(ByteOrder byteOrder)
    Constructs a new instance.
    Parameters:
      `byteOrder` - the byte order.

- ## Method Details

  - ### getAllImageParsers

    public static List<AbstractImageParser<?>> getAllImageParsers()
    Gets an array of new instances of all image parsers.
    Returns:
      A valid array of image parsers

  - ### canAcceptExtension

    public boolean canAcceptExtension(File file)
    Tests whether the ImageParser implementation can accept the specified file based on its extension.
    Parameters:
      `file` - An valid file reference.
    Returns:
      If the parser can accept the format, true; otherwise, false.

  - ### canAcceptExtension

    public final boolean canAcceptExtension(String fileName)
    Tests whether the ImageParser implementation can accept the specified file name based on its extension.
    Parameters:
      `fileName` - A valid string giving a file name or file path.
    Returns:
      If the parser can accept the format, true; otherwise, false.

  - ### canAcceptType

    public boolean canAcceptType(ImageFormat imageFormat)
    Tests whether the ImageParser implementation can accept the specified format.
    Parameters:
      `imageFormat` - An instance of ImageFormat.
    Returns:
      If the parser can accept the format, true; otherwise, false.

  - ### dumpImageFile

    public final String dumpImageFile(byte[] bytes) throws ImagingException, IOException
    Writes the ImageInfo and format-specific information for the image content of the specified byte array to a string.
    Parameters:
      `bytes` - A valid array of bytes.
    Returns:
      A valid string.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### dumpImageFile

    public final String dumpImageFile(ByteSource byteSource) throws ImagingException, IOException
    Writes the ImageInfo and format-specific information for the image content of the specified byte source to a string.
    Parameters:
      `byteSource` - A valid byte source.
    Returns:
      A valid string.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### dumpImageFile

    public final String dumpImageFile(File file) throws ImagingException, IOException
    Writes the ImageInfo and format-specific information for the image content of the specified file to a string.
    Parameters:
      `file` - A valid file reference.
    Returns:
      A valid string.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### dumpImageFile

    public boolean dumpImageFile(PrintWriter pw, ByteSource byteSource) throws ImagingException, IOException
    Writes the ImageInfo and format-specific information for the image content of the specified byte source to a PrintWriter
    Parameters:
      `pw` - print writer used for writing the ImageInfo
      `byteSource` - A valid byte source.
    Returns:
      A valid PrintWriter.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getAcceptedExtensions

    protected abstract String[] getAcceptedExtensions()
    Gets an array of all accepted extensions
    Returns:
      A valid array of one or more elements.

  - ### getAcceptedTypes

    protected abstract ImageFormat[] getAcceptedTypes()
    Gets an array of ImageFormat objects describing all accepted types
    Returns:
      A valid array of one or more elements.

  - ### getAllBufferedImages

    public final List<BufferedImage> getAllBufferedImages(byte[] bytes) throws ImagingException, IOException
    Gets all images specified by the byte array (some formats may include multiple images within a single data source).
    Parameters:
      `bytes` - A valid byte array
    Returns:
      A valid (potentially empty) list of BufferedImage objects.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getAllBufferedImages

    public List<BufferedImage> getAllBufferedImages(ByteSource byteSource) throws ImagingException, IOException
    Gets all images specified by the byte source (some formats may include multiple images within a single data source).
    Parameters:
      `byteSource` - A valid instance of ByteSource.
    Returns:
      A valid (potentially empty) list of BufferedImage objects.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getAllBufferedImages

    public final List<BufferedImage> getAllBufferedImages(File file) throws ImagingException, IOException
    Gets all images specified by indicated file (some formats may include multiple images within a single data source).
    Parameters:
      `file` - A valid reference to a file.
    Returns:
      A valid (potentially empty) list of BufferedImage objects.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getBufferedImage

    public final BufferedImage getBufferedImage(byte[] bytes, T params) throws ImagingException, IOException
    Gets a buffered image specified by the byte array (for sources that specify multiple images, choice of which image is returned is implementation dependent).
    Parameters:
      `bytes` - A valid byte array
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid instance of BufferedImage.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getBufferedImage

    public abstract BufferedImage getBufferedImage(ByteSource byteSource, T params) throws ImagingException, IOException
    Gets a buffered image specified by the byte source (for sources that specify multiple images, choice of which image is returned is implementation dependent).
    Parameters:
      `byteSource` - A valid instance of ByteSource
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid instance of BufferedImage.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getBufferedImage

    public final BufferedImage getBufferedImage(File file, T params) throws ImagingException, IOException
    Gets a buffered image specified by the indicated file (for sources that specify multiple images, choice of which image is returned is implementation dependent).
    Parameters:
      `file` - A valid file reference.
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid instance of BufferedImage.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getBufferedImageFactory

    protected BufferedImageFactory getBufferedImageFactory(T params)
    Gets an instance of IBufferedImageFactory based on the presence of a specification for ImagingConstants..BUFFERED_IMAGE_FACTORY within the supplied params.
    Parameters:
      `params` - optional parameters.
    Returns:
      A valid instance of an implementation of a IBufferedImageFactory.

  - ### getDefaultExtension

    public abstract String getDefaultExtension()
    Gets the default extension for the format specified by an implementation of ImageParser. Some parsers can support more than one extension (i.e. .JPEG, .JPG; .TIF, .TIFF, etc.).
    Returns:
      A valid string.

  - ### getDefaultParameters

    public abstract T getDefaultParameters()
    Gets a default parameters instance for this parser.
    Returns:
      default parameters instance

  - ### getFormatCompliance

    public final FormatCompliance getFormatCompliance(byte[] bytes) throws ImagingException, IOException
    Determines the format compliance of the content of the supplied byte array based on rules provided by a specific implementation.
    Parameters:
      `bytes` - A valid byte array.
    Returns:
      A valid FormatCompliance object.
    Throws:
      `ImagingException` - may be thrown by sub-classes
      `IOException` - may be thrown by sub-classes

  - ### getFormatCompliance

    public FormatCompliance getFormatCompliance(ByteSource byteSource) throws ImagingException, IOException
    Determines the format compliance of the content of the supplied byte source based on rules provided by a specific implementation.
    Parameters:
      `byteSource` - A valid instance of ByteSource
    Returns:
      true if the content is format-compliant; otherwise, false
    Throws:
      `ImagingException` - may be thrown by sub-classes
      `IOException` - may be thrown by sub-classes

  - ### getFormatCompliance

    public final FormatCompliance getFormatCompliance(File file) throws ImagingException, IOException
    Determines the format compliance of the specified file based on rules provided by a specific implementation.
    Parameters:
      `file` - A valid reference to a file.
    Returns:
      A valid format compliance object.
    Throws:
      `ImagingException` - may be thrown by sub-classes
      `IOException` - may be thrown by sub-classes

  - ### getIccProfileBytes

    public final byte[] getIccProfileBytes(byte[] bytes) throws ImagingException, IOException
    Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input byte array. Not all formats support ICC profiles.
    Parameters:
      `bytes` - A valid array of bytes.
    Returns:
      If available, a valid array of bytes; otherwise, a null
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getIccProfileBytes

    public final byte[] getIccProfileBytes(byte[] bytes, T params) throws ImagingException, IOException
    Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input byte array. Not all formats support ICC profiles.
    Parameters:
      `bytes` - A valid array of bytes.
      `params` - Optional instructions for special-handling or interpretation of the input data.
    Returns:
      If available, a valid array of bytes; otherwise, a null
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getIccProfileBytes

    public abstract byte[] getIccProfileBytes(ByteSource byteSource, T params) throws ImagingException, IOException
    Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input byteSource. Not all formats support ICC profiles.
    Parameters:
      `byteSource` - A valid ByteSource.
      `params` - Optional instructions for special-handling or interpretation of the input data.
    Returns:
      If available, a valid array of bytes; otherwise, a null
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getIccProfileBytes

    public final byte[] getIccProfileBytes(File file) throws ImagingException, IOException
    Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input file. Not all formats support ICC profiles.
    Parameters:
      `file` - A valid file reference.
    Returns:
      If available, a valid array of bytes; otherwise, a null
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getIccProfileBytes

    public final byte[] getIccProfileBytes(File file, T params) throws ImagingException, IOException
    Gets an array of bytes describing the International Color Consortium (ICC) specification for the color space of the image contained in the input file. Not all formats support ICC profiles.
    Parameters:
      `file` - A valid file reference.
      `params` - Optional instructions for special-handling or interpretation of the input data.
    Returns:
      If available, a valid array of bytes; otherwise, a null
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getImageInfo

    public final ImageInfo getImageInfo(byte[] bytes, T params) throws ImagingException, IOException
    Gets image information from the specified array of bytes. Format-specific ImageParser implementations are expected to return a valid ImageInfo object or to throw an ImageReadException if unable to process the specified data.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will require this capability. Because the base class may call this method with a null params argument, implementations should always include logic for ignoring null input.

    Parameters:
      `bytes` - A valid array of bytes
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid image information object describing the content extracted from the specified data.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data access operation.

  - ### getImageInfo

    public final ImageInfo getImageInfo(ByteSource byteSource) throws ImagingException, IOException
    Gets image information from the specified ByteSource. Format-specific ImageParser implementations are expected to return a valid ImageInfo object or to throw an ImageReadException if unable to process the specified data.
    Parameters:
      `byteSource` - A valid ByteSource object
    Returns:
      A valid image information object describing the content extracted from the specified data.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data access operation.

  - ### getImageInfo

    public abstract ImageInfo getImageInfo(ByteSource byteSource, T params) throws ImagingException, IOException
    Gets image information from the specified ByteSource. Format-specific ImageParser implementations are expected to return a valid ImageInfo object or to throw an ImageReadException if unable to process the specified data.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will require this capability. Because the base class may call this method with a null params argument, implementations should always include logic for ignoring null input.

    Parameters:
      `byteSource` - A valid ByteSource object
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid image information object describing the content extracted from the specified data.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data access operation.

  - ### getImageInfo

    public final ImageInfo getImageInfo(File file, T params) throws ImagingException, IOException
    Gets image information from the specified file Format-specific ImageParser implementations are expected to return a valid ImageInfo object or to throw an ImageReadException if unable to process the specified data.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will require this capability. Because the base class may call this method with a null params argument, implementations should always include logic for ignoring null input.

    Parameters:
      `file` - A valid File object
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid image information object describing the content extracted from the specified data.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful file read or access operation.

  - ### getImageSize

    public final Dimension getImageSize(byte[] bytes) throws ImagingException, IOException
    Gets the size of the image described by the specified byte array.
    Parameters:
      `bytes` - A valid byte array.
    Returns:
      A valid instance of Dimension.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getImageSize

    public final Dimension getImageSize(byte[] bytes, T params) throws ImagingException, IOException
    Gets the size of the image described by the specified byte array.
    Parameters:
      `bytes` - A valid byte array.
      `params` - Optional instructions for special-handling or interpretation of the input data.
    Returns:
      A valid instance of Dimension.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getImageSize

    public abstract Dimension getImageSize(ByteSource byteSource, T params) throws ImagingException, IOException
    Gets the size of the image described by the specified ByteSource.
    Parameters:
      `byteSource` - A valid reference to a ByteSource.
      `params` - Optional instructions for special-handling or interpretation of the input data.
    Returns:
      A valid instance of Dimension.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getImageSize

    public final Dimension getImageSize(File file) throws ImagingException, IOException
    Gets the size of the image described by the specified file.
    Parameters:
      `file` - A valid reference to a file.
    Returns:
      A valid instance of Dimension.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getImageSize

    public final Dimension getImageSize(File file, T params) throws ImagingException, IOException
    Gets the size of the image described by the specified file.
    Parameters:
      `file` - A valid reference to a file.
      `params` - Optional instructions for special-handling or interpretation of the input data.
    Returns:
      A valid instance of Dimension.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful read or access operation.

  - ### getMetadata

    public final ImageMetadata getMetadata(byte[] bytes) throws ImagingException, IOException
    Gets image metadata from the specified array of bytes. Format-specific ImageParser implementations are expected to return a valid IImageMetadata object or to throw an ImageReadException if unable to process the specified data.
    Parameters:
      `bytes` - A valid array of bytes
    Returns:
      A valid, potentially subject-matter-specific implementation of the IImageMetadata interface describing the content extracted from the source content.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data read operation.

  - ### getMetadata

    public final ImageMetadata getMetadata(byte[] bytes, T params) throws ImagingException, IOException
    Gets image metadata from the specified array of bytes. Format-specific ImageParser implementations are expected to return a valid IImageMetadata object or to throw an ImageReadException if unable to process the specified data.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will require this capability. Because the base class may call this method with a null params argument, implementations should always include logic for ignoring null input.

    Parameters:
      `bytes` - A valid array of bytes
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid image metadata object describing the content extracted from the specified content.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data read operation.

  - ### getMetadata

    public final ImageMetadata getMetadata(ByteSource byteSource) throws ImagingException, IOException
    Gets image metadata from the specified byte source. Format-specific ImageParser implementations are expected to return a valid IImageMetadata object or to throw an ImageReadException if unable to process the specified byte source.
    Parameters:
      `byteSource` - A valid byte source.
    Returns:
      A valid, potentially subject-matter-specific implementation of the IImageMetadata interface describing the content extracted from the source content.
    Throws:
      `ImagingException` - In the event that the ByteSource content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data read operation.

  - ### getMetadata

    public abstract ImageMetadata getMetadata(ByteSource byteSource, T params) throws ImagingException, IOException
    Gets image metadata from the specified byte source. Format-specific ImageParser implementations are expected to return a valid IImageMetadata object or to throw an ImageReadException if unable to process the specified byte source.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will require this capability. Because the base class may call this method with a null params argument, implementations should always include logic for ignoring null input.

    Parameters:
      `byteSource` - A valid byte source.
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid, potentially subject-matter-specific implementation of the IImageMetadata interface describing the content extracted from the source content.
    Throws:
      `ImagingException` - In the event that the ByteSource content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful data read operation.

  - ### getMetadata

    public final ImageMetadata getMetadata(File file) throws ImagingException, IOException
    Gets image metadata from the specified file. Format-specific ImageParser implementations are expected to return a valid IImageMetadata object or to throw an ImageReadException if unable to process the specified data.
    Parameters:
      `file` - A valid reference to a file.
    Returns:
      A valid image metadata object describing the content extracted from the specified content.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful file read or access operation.

  - ### getMetadata

    public final ImageMetadata getMetadata(File file, T params) throws ImagingException, IOException
    Gets image metadata from the specified file. Format-specific ImageParser implementations are expected to return a valid IImageMetadata object or to throw an ImageReadException if unable to process the specified data.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will require this capability. Because the base class may call this method with a null params argument, implementations should always include logic for ignoring null input.

    Parameters:
      `file` - A valid reference to a file.
      `params` - Optional instructions for special-handling or interpretation of the input data (null objects are permitted and must be supported by implementations).
    Returns:
      A valid image metadata object describing the content extracted from the specified content.
    Throws:
      `ImagingException` - In the event that the specified content does not conform to the format of the specific parser implementation.
      `IOException` - In the event of unsuccessful file read or access operation.

  - ### getName

    public abstract String getName()
    Gets a descriptive name for the implementation of an ImageParser.
    Returns:
      a valid, subject-matter-specific string.

  - ### writeImage

    public void writeImage(BufferedImage src, OutputStream os, T params) throws ImagingException, IOException
    Writes the content of a BufferedImage to the specified output stream.

    The params argument provides a mechanism for individual implementations to pass optional information into the parser. Not all formats will support this capability. Currently, some of the parsers do not check for null arguments.

    Parameters:
      `src` - An image giving the source content for output
      `os` - A valid output stream for storing the formatted image
      `params` - optional parameters, defining format-specific instructions for output (such as selections for data compression, color models, etc.)
    Throws:
      `ImagingException` - In the event that the output format cannot handle the input image or invalid params are specified.
      `IOException` - In the event of an write error from the output stream.