com.pearsoneduc.ip.io
Class ImageFile
java.lang.Object
|
+--com.pearsoneduc.ip.io.ImageFile
- public class ImageFile
- extends java.lang.Object
Defines static factory methods that create image encoders and
decoders for files.
Each encoder implements the ImageEncoder
interface and
therefore provides a method named
encode which can be used
to write the image to a file. Similarly, each decoder implements
the ImageDecoder
interface and therefore provides a method
decodeAsBufferedImage
which can be used to read data from a file.
Appropriate encoders / decoders are created by examining the suffix
of the filename supplied to the factory methods. For example, if the
filename ends with .jpg, a JPEGEncoder
will be
created to write the file, or a JPEGDecoder
to read it.
- Version:
- 1.0 [1999/06/28]
- Author:
- Nick Efford
- See Also:
ImageEncoder
,
ImageDecoder
,
ImageEncoderException
,
ImageDecoderException
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ImageFile
public ImageFile()
createImageEncoder
public static ImageEncoder createImageEncoder(java.lang.String filename)
throws java.io.IOException,
ImageEncoderException
- Creates an ImageEncoder suitable for use with the specified filename.
- Parameters:
filename
- name of the image file- Returns:
- new instance of a suitable ImageEncoder.
- Throws:
- java.io.IOException - if there was some problem with output
- ImageEncoderException - if the image type is unsupported by
the format or could not be encoded in that format.
createImageDecoder
public static ImageDecoder createImageDecoder(java.lang.String filename)
throws java.io.IOException,
ImageDecoderException
- Creates an ImageDecoder suitable for use with the specified filename.
- Parameters:
filename
- name of the image file- Returns:
- new instance of a suitable ImageDecoder.
- Throws:
- java.io.IOException - if there was some problem with reading data
- ImageDecoderException - if the file does not appear to
follow the expected format.