org.apache.sanselan.formats.pnm
Class PNMImageParser

java.lang.Object
  extended by org.apache.sanselan.common.BinaryFileFunctions
      extended by org.apache.sanselan.common.BinaryFileParser
          extended by org.apache.sanselan.ImageParser
              extended by org.apache.sanselan.formats.pnm.PNMImageParser
All Implemented Interfaces:
BinaryConstants, PNMConstants, SanselanConstants

public class PNMImageParser
extends ImageParser
implements PNMConstants


Field Summary
static java.lang.String PARAM_KEY_PNM_RAWBITS
           
static java.lang.String PARAM_VALUE_PNM_RAWBITS_NO
           
static java.lang.String PARAM_VALUE_PNM_RAWBITS_YES
           
 
Fields inherited from class org.apache.sanselan.common.BinaryFileFunctions
debug
 
Fields inherited from interface org.apache.sanselan.formats.pnm.PNMConstants
PBM_RAW_CODE, PBM_TEXT_CODE, PGM_RAW_CODE, PGM_TEXT_CODE, PNM_PREFIX_BYTE, PNM_SEPARATOR, PPM_RAW_CODE, PPM_TEXT_CODE
 
Fields inherited from interface org.apache.sanselan.SanselanConstants
BUFFERED_IMAGE_FACTORY, PARAM_KEY_COMPRESSION, PARAM_KEY_FILENAME, PARAM_KEY_FORMAT, PARAM_KEY_READ_THUMBNAILS, PARAM_KEY_STRICT, PARAM_KEY_VERBOSE, PARAM_KEY_XMP_XML
 
Fields inherited from interface org.apache.sanselan.common.BinaryConstants
BYTE_ORDER_BIG_ENDIAN, BYTE_ORDER_INTEL, BYTE_ORDER_LEAST_SIGNIFICANT_BYTE, BYTE_ORDER_LITTLE_ENDIAN, BYTE_ORDER_LSB, BYTE_ORDER_MOST_SIGNIFICANT_BYTE, BYTE_ORDER_MOTOROLA, BYTE_ORDER_MSB, BYTE_ORDER_NETWORK
 
Constructor Summary
PNMImageParser()
           
 
Method Summary
 boolean dumpImageFile(java.io.PrintWriter pw, ByteSource byteSource)
           
 byte[] embedICCProfile(byte[] image, byte[] profile)
           
 boolean embedICCProfile(java.io.File src, java.io.File dst, byte[] profile)
           
protected  java.lang.String[] getAcceptedExtensions()
           
protected  ImageFormat[] getAcceptedTypes()
           
 java.awt.image.BufferedImage getBufferedImage(ByteSource byteSource, java.util.Map params)
           
 java.lang.String getDefaultExtension()
           
 byte[] getICCProfileBytes(ByteSource byteSource, java.util.Map params)
           
 ImageInfo getImageInfo(ByteSource byteSource, java.util.Map params)
           
 java.awt.Dimension getImageSize(ByteSource byteSource, java.util.Map params)
           
 IImageMetadata getMetadata(ByteSource byteSource, java.util.Map params)
           
 java.lang.String getName()
           
 java.lang.String getXmpXml(ByteSource byteSource, java.util.Map params)
          Extracts embedded XML metadata as XML string.
 void writeImage(java.awt.image.BufferedImage src, java.io.OutputStream os, java.util.Map params)
           
 
Methods inherited from class org.apache.sanselan.ImageParser
canAcceptExtension, canAcceptExtension, canAcceptType, dumpImageFile, dumpImageFile, dumpImageFile, getAllBufferedImages, getAllBufferedImages, getAllBufferedImages, getAllImageParsers, getBufferedImage, getBufferedImage, getBufferedImageFactory, getFormatCompliance, getFormatCompliance, getFormatCompliance, getICCProfileBytes, getICCProfileBytes, getICCProfileBytes, getICCProfileBytes, getImageInfo, getImageInfo, getImageInfo, getImageSize, getImageSize, getImageSize, getImageSize, getMetadata, getMetadata, getMetadata, getMetadata, getMetadata, isStrict
 
Methods inherited from class org.apache.sanselan.common.BinaryFileParser
byteArrayHasPrefix, convertByteArrayToInt, convertByteArrayToInt, convertByteArrayToShort, convertByteArrayToShort, getByteOrder, int2ToByteArray, read2Bytes, read3Bytes, read4Bytes, setByteOrder, setByteOrder
 
Methods inherited from class org.apache.sanselan.common.BinaryFileFunctions
CharsToQuad, compareByteArrays, compareByteArrays, compareBytes, compareBytes, convertByteArrayToDouble, convertByteArrayToDouble, convertByteArrayToDoubleArray, convertByteArrayToFloat, convertByteArrayToFloat, convertByteArrayToFloatArray, convertByteArrayToInt, convertByteArrayToInt, convertByteArrayToIntArray, convertByteArrayToRational, convertByteArrayToRational, convertByteArrayToRationalArray, convertByteArrayToShort, convertByteArrayToShort, convertByteArrayToShortArray, convertDoubleArrayToByteArray, convertDoubleToByteArray, convertFloatArrayToByteArray, convertFloatToByteArray, convertIntArrayToByteArray, convertIntArrayToRationalArray, convertRationalArrayToByteArray, convertRationalToByteArray, convertShortArrayToByteArray, convertShortToByteArray, copyStreamToStream, debugByteArray, debugNumber, debugNumber, debugNumber, debugNumber, debugNumberArray, findNull, findNull, getBytearrayHead, getByteArrayTail, getDebug, getRAFBytes, getStreamBytes, head, int2ToByteArray, printByteBits, printCharQuad, printCharQuad, read2Bytes, read3Bytes, read4Bytes, readAndVerifyBytes, readAndVerifyBytes, readByte, readBytearray, readByteArray, readByteArray, readBytes, readRandomBytes, scanForByte, setDebug, skipBytes, skipBytes, slice, startsWith, tail, writeIntInToByteArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_KEY_PNM_RAWBITS

public static final java.lang.String PARAM_KEY_PNM_RAWBITS
See Also:
Constant Field Values

PARAM_VALUE_PNM_RAWBITS_YES

public static final java.lang.String PARAM_VALUE_PNM_RAWBITS_YES
See Also:
Constant Field Values

PARAM_VALUE_PNM_RAWBITS_NO

public static final java.lang.String PARAM_VALUE_PNM_RAWBITS_NO
See Also:
Constant Field Values
Constructor Detail

PNMImageParser

public PNMImageParser()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class ImageParser

getDefaultExtension

public java.lang.String getDefaultExtension()
Specified by:
getDefaultExtension in class ImageParser

getAcceptedExtensions

protected java.lang.String[] getAcceptedExtensions()
Specified by:
getAcceptedExtensions in class ImageParser

getAcceptedTypes

protected ImageFormat[] getAcceptedTypes()
Specified by:
getAcceptedTypes in class ImageParser

getICCProfileBytes

public byte[] getICCProfileBytes(ByteSource byteSource,
                                 java.util.Map params)
                          throws ImageReadException,
                                 java.io.IOException
Specified by:
getICCProfileBytes in class ImageParser
Throws:
ImageReadException
java.io.IOException

getImageSize

public java.awt.Dimension getImageSize(ByteSource byteSource,
                                       java.util.Map params)
                                throws ImageReadException,
                                       java.io.IOException
Specified by:
getImageSize in class ImageParser
Throws:
ImageReadException
java.io.IOException

embedICCProfile

public byte[] embedICCProfile(byte[] image,
                              byte[] profile)

embedICCProfile

public boolean embedICCProfile(java.io.File src,
                               java.io.File dst,
                               byte[] profile)
Specified by:
embedICCProfile in class ImageParser

getMetadata

public IImageMetadata getMetadata(ByteSource byteSource,
                                  java.util.Map params)
                           throws ImageReadException,
                                  java.io.IOException
Specified by:
getMetadata in class ImageParser
Throws:
ImageReadException
java.io.IOException

getImageInfo

public ImageInfo getImageInfo(ByteSource byteSource,
                              java.util.Map params)
                       throws ImageReadException,
                              java.io.IOException
Specified by:
getImageInfo in class ImageParser
Throws:
ImageReadException
java.io.IOException

dumpImageFile

public boolean dumpImageFile(java.io.PrintWriter pw,
                             ByteSource byteSource)
                      throws ImageReadException,
                             java.io.IOException
Overrides:
dumpImageFile in class ImageParser
Throws:
ImageReadException
java.io.IOException

getBufferedImage

public java.awt.image.BufferedImage getBufferedImage(ByteSource byteSource,
                                                     java.util.Map params)
                                              throws ImageReadException,
                                                     java.io.IOException
Specified by:
getBufferedImage in class ImageParser
Throws:
ImageReadException
java.io.IOException

writeImage

public void writeImage(java.awt.image.BufferedImage src,
                       java.io.OutputStream os,
                       java.util.Map params)
                throws ImageWriteException,
                       java.io.IOException
Overrides:
writeImage in class ImageParser
Throws:
ImageWriteException
java.io.IOException

getXmpXml

public java.lang.String getXmpXml(ByteSource byteSource,
                                  java.util.Map params)
                           throws ImageReadException,
                                  java.io.IOException
Extracts embedded XML metadata as XML string.

Specified by:
getXmpXml in class ImageParser
Parameters:
file - File containing image data.
params - Map of optional parameters, defined in SanselanConstants.
Returns:
Xmp Xml as String, if present. Otherwise, returns null..
Throws:
ImageReadException
java.io.IOException


Copyright © 2007-2009. All Rights Reserved.