java.lang.Object
non_com.media.jai.codec.ImageEncoderImpl
non_com.media.jai.codec.PNMImageEncoder
- All Implemented Interfaces:
- ImageEncoder
- public class PNMImageEncoder
- extends ImageEncoderImpl
An ImageEncoder for the PNM family of file formats.
The PNM file format includes PBM for monochrome images, PGM for grey scale
images, and PPM for color images. When writing the source data out, the
encoder chooses the appropriate file variant based on the actual SampleModel
of the source image. In case the source image data is unsuitable for the PNM
file format, for example when source has 4 bands or float data type, the
encoder throws an Error.
The raw file format is used wherever possible, unless the PNMEncodeParam
object supplied to the constructor returns true from its getRaw()
method.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PBM_ASCII
private static final int PBM_ASCII
- See Also:
- Constant Field Values
PGM_ASCII
private static final int PGM_ASCII
- See Also:
- Constant Field Values
PPM_ASCII
private static final int PPM_ASCII
- See Also:
- Constant Field Values
PBM_RAW
private static final int PBM_RAW
- See Also:
- Constant Field Values
PGM_RAW
private static final int PGM_RAW
- See Also:
- Constant Field Values
PPM_RAW
private static final int PPM_RAW
- See Also:
- Constant Field Values
SPACE
private static final int SPACE
- See Also:
- Constant Field Values
COMMENT
private static final java.lang.String COMMENT
- See Also:
- Constant Field Values
lineSeparator
private byte[] lineSeparator
variant
private int variant
maxValue
private int maxValue
PNMImageEncoder
public PNMImageEncoder(java.io.OutputStream output,
ImageEncodeParam param)
- Constructor for the PNMImageEncoder object
encode
public void encode(java.awt.image.RenderedImage im)
throws java.io.IOException
- Encodes a RenderedImage and writes the output to the OutputStream
associated with this ImageEncoder.
- Specified by:
encode in interface ImageEncoder- Specified by:
encode in class ImageEncoderImpl
isRaw
private boolean isRaw(int v)
- Returns true if file variant is raw format, false if ASCII.
writeInteger
private void writeInteger(java.io.OutputStream output,
int i)
throws java.io.IOException
- Writes an integer to the output in ASCII format.
writeByte
private void writeByte(java.io.OutputStream output,
byte b)
throws java.io.IOException
- Writes a byte to the output in ASCII format.