org.apache.sanselan.formats.png
Class PngImageParser

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.png.PngImageParser
All Implemented Interfaces:
BinaryConstants, PngConstants, SanselanConstants

public class PngImageParser
extends ImageParser
implements PngConstants


Field Summary
 
Fields inherited from class org.apache.sanselan.common.BinaryFileFunctions
debug
 
Fields inherited from interface org.apache.sanselan.formats.png.PngConstants
COLOR_TYPE_GREYSCALE, COLOR_TYPE_GREYSCALE_WITH_ALPHA, COLOR_TYPE_INDEXED_COLOR, COLOR_TYPE_TRUE_COLOR, COLOR_TYPE_TRUE_COLOR_WITH_ALPHA, COMPRESSION_DEFLATE_INFLATE, COMPRESSION_TYPE_INFLATE_DEFLATE, FILTER_METHOD_ADAPTIVE, FILTER_TYPE_AVERAGE, FILTER_TYPE_NONE, FILTER_TYPE_PAETH, FILTER_TYPE_SUB, FILTER_TYPE_UP, gAMA, iCCP, IDAT, IDAT_CHUNK_TYPE, IEND, IEND_CHUNK_TYPE, IHDR, IHDR_CHUNK_TYPE, INTERLACE_METHOD_ADAM7, INTERLACE_METHOD_NONE, iTXt, iTXt_CHUNK_TYPE, PARAM_KEY_PNG_BIT_DEPTH, PARAM_KEY_PNG_FORCE_INDEXED_COLOR, PARAM_KEY_PNG_FORCE_TRUE_COLOR, PARAM_KEY_PNG_TEXT_CHUNKS, pHYs, PLTE, PLTE_CHUNK_TYPE, PNG_Signature, sRGB, tEXt, tEXt_CHUNK_TYPE, tRNS, XMP_KEYWORD, zTXt, zTXt_CHUNK_TYPE
 
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
PngImageParser()
           
 
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
 

Constructor Detail

PngImageParser

public PngImageParser()
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

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

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

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.