Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

non_com.media.jai.codec
Class PNMCodec  view PNMCodec download PNMCodec.java

java.lang.Object
  extended bynon_com.media.jai.codec.ImageCodec
      extended bynon_com.media.jai.codec.PNMCodec

public final class PNMCodec
extends ImageCodec

A subclass of ImageCodec that handles the PNM family of formats (PBM, PGM, PPM).

The PBM format encodes a single-banded, 1-bit image. The PGM format encodes a single-banded image of any bit depth between 1 and 32. The PPM format encodes three-banded images of any bit depth between 1 and 32. All formats have an ASCII and a raw representation.


Field Summary
 
Fields inherited from class non_com.media.jai.codec.ImageCodec
 
Constructor Summary
PNMCodec()
          Constructs an instance of PNMCodec.
 
Method Summary
 boolean canEncodeImage(java.awt.image.RenderedImage im, ImageEncodeParam param)
          Description of the Method
protected  ImageDecoder createImageDecoder(java.io.InputStream src, ImageDecodeParam param)
          Instantiates a PNMImageDecoder to read from the given InputStream .
protected  ImageDecoder createImageDecoder(SeekableStream src, ImageDecodeParam param)
          Instantiates a PNMImageDecoder to read from the given SeekableStream .
protected  ImageEncoder createImageEncoder(java.io.OutputStream dst, ImageEncodeParam param)
          Instantiates a PNMImageEncoder to write to the given OutputStream .
 java.lang.Class getDecodeParamClass()
          Gets the DecodeParamClass attribute of the PNMCodec object
 java.lang.Class getEncodeParamClass()
          Gets the EncodeParamClass attribute of the PNMCodec object
 java.lang.String getFormatName()
          Returns the name of the format handled by this codec.
 int getNumHeaderBytes()
          Returns the number of bytes from the beginning of the data required to recognize it as being in PNM format.
 boolean isFormatRecognized(byte[] header)
          Returns true if the header bytes indicate PNM format.
 
Methods inherited from class non_com.media.jai.codec.ImageCodec
createComponentColorModel, createGrayIndexColorModel, createImageDecoder, createImageDecoder, createImageDecoder, createImageDecoder, createImageEncoder, getCodec, getCodecs, getDecoderNames, getEncoderNames, isFormatRecognized, registerCodec, unregisterCodec
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PNMCodec

public PNMCodec()
Constructs an instance of PNMCodec.

Method Detail

getFormatName

public java.lang.String getFormatName()
Returns the name of the format handled by this codec.

Specified by:
getFormatName in class ImageCodec

getEncodeParamClass

public java.lang.Class getEncodeParamClass()
Gets the EncodeParamClass attribute of the PNMCodec object

Specified by:
getEncodeParamClass in class ImageCodec

getDecodeParamClass

public java.lang.Class getDecodeParamClass()
Gets the DecodeParamClass attribute of the PNMCodec object

Specified by:
getDecodeParamClass in class ImageCodec

getNumHeaderBytes

public int getNumHeaderBytes()
Returns the number of bytes from the beginning of the data required to recognize it as being in PNM format.

Overrides:
getNumHeaderBytes in class ImageCodec

isFormatRecognized

public boolean isFormatRecognized(byte[] header)
Returns true if the header bytes indicate PNM format.

Overrides:
isFormatRecognized in class ImageCodec

canEncodeImage

public boolean canEncodeImage(java.awt.image.RenderedImage im,
                              ImageEncodeParam param)
Description of the Method

Specified by:
canEncodeImage in class ImageCodec

createImageEncoder

protected ImageEncoder createImageEncoder(java.io.OutputStream dst,
                                          ImageEncodeParam param)
Instantiates a PNMImageEncoder to write to the given OutputStream .

Specified by:
createImageEncoder in class ImageCodec

createImageDecoder

protected ImageDecoder createImageDecoder(java.io.InputStream src,
                                          ImageDecodeParam param)
Instantiates a PNMImageDecoder to read from the given InputStream .

By overriding this method, PNMCodec is able to ensure that a ForwardSeekableStream is used to wrap the source InputStream instead of the a general (and more expensive) subclass of SeekableStream . Since the PNM decoder does not require the ability to seek backwards in its input, this allows for greater efficiency.

Overrides:
createImageDecoder in class ImageCodec

createImageDecoder

protected ImageDecoder createImageDecoder(SeekableStream src,
                                          ImageDecodeParam param)
Instantiates a PNMImageDecoder to read from the given SeekableStream .

Specified by:
createImageDecoder in class ImageCodec