Class AbstractImageParser<T extends ImagingParameters<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
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
ConstructorsConstructorDescriptionConstructs a new instance with the default, big-endian, byte order.AbstractImageParser
(ByteOrder byteOrder) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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 PrintWriterfinal 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[]
Gets an array of all accepted extensionsprotected abstract ImageFormat[]
Gets an array of ImageFormat objects describing all accepted typesfinal 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).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<?>> 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
Gets the default extension for the format specified by an implementation of ImageParser.abstract T
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.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
-
Constructor Details
-
AbstractImageParser
public AbstractImageParser()Constructs a new instance with the default, big-endian, byte order. -
AbstractImageParser
Constructs a new instance.- Parameters:
byteOrder
- the byte order.
-
-
Method Details
-
getAllImageParsers
Gets an array of new instances of all image parsers.- Returns:
- A valid array of image parsers
-
canAcceptExtension
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
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
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
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
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
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 ImageInfobyteSource
- 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
Gets an array of all accepted extensions- Returns:
- A valid array of one or more elements.
-
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 arrayparams
- 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 ByteSourceparams
- 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
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
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
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-classesIOException
- 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-classesIOException
- may be thrown by sub-classes
-
getFormatCompliance
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-classesIOException
- may be thrown by sub-classes
-
getIccProfileBytes
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
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
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
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
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 bytesparams
- 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
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 objectparams
- 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
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 objectparams
- 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
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
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
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
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
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
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 bytesparams
- 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
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
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
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
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 outputos
- A valid output stream for storing the formatted imageparams
- 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.
-