Class PNGChunk


  • public class PNGChunk
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PNGChunk.ChunkType
      See http://en.wikipedia.org/wiki/Portable_Network_Graphics for a light explanation; See http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html for the spec.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int crc  
      (package private) byte[] data  
      (package private) int length  
      protected static org.apache.commons.logging.Log log
      logger
      (package private) int type  
      (package private) java.lang.String typeString  
    • Constructor Summary

      Constructors 
      Constructor Description
      PNGChunk​(int length, int type, byte[] data, int crc)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte getByte​(int offset)  
      static java.lang.String getChunkType​(java.io.DataInputStream distream)
      Returns the PNG chunk type, a four letter case sensitive ASCII type/name.
      byte[] getData()  
      int getInt1​(int offset)  
      int getInt2​(int offset)  
      int getInt4​(int offset)  
      int getLength()  
      java.lang.String getString4​(int offset)  
      int getType()  
      java.lang.String getTypeString()  
      boolean isType​(java.lang.String typeName)  
      static PNGChunk readChunk​(java.io.DataInputStream distream)
      Reads the next chunk from the input stream.
      static boolean skipChunk​(java.io.DataInputStream distream)
      Skips the next chunk from the input stream.
      private static java.lang.String typeIntToString​(int type)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • length

        int length
      • type

        int type
      • data

        byte[] data
      • crc

        int crc
      • typeString

        java.lang.String typeString
      • log

        protected static final org.apache.commons.logging.Log log
        logger
    • Constructor Detail

      • PNGChunk

        public PNGChunk​(int length,
                        int type,
                        byte[] data,
                        int crc)
    • Method Detail

      • getLength

        public int getLength()
      • getType

        public int getType()
      • getTypeString

        public java.lang.String getTypeString()
      • getData

        public byte[] getData()
      • getByte

        public byte getByte​(int offset)
      • getInt1

        public int getInt1​(int offset)
      • getInt2

        public int getInt2​(int offset)
      • getInt4

        public int getInt4​(int offset)
      • getString4

        public java.lang.String getString4​(int offset)
      • isType

        public boolean isType​(java.lang.String typeName)
      • readChunk

        public static PNGChunk readChunk​(java.io.DataInputStream distream)
        Reads the next chunk from the input stream.
        Parameters:
        distream - the input stream
        Returns:
        the chunk
      • getChunkType

        public static java.lang.String getChunkType​(java.io.DataInputStream distream)
        Returns the PNG chunk type, a four letter case sensitive ASCII type/name.
        Parameters:
        distream - the input stream
        Returns:
        a four letter case sensitive ASCII type/name
      • typeIntToString

        private static java.lang.String typeIntToString​(int type)
      • skipChunk

        public static boolean skipChunk​(java.io.DataInputStream distream)
        Skips the next chunk from the input stream.
        Parameters:
        distream - the input stream
        Returns:
        true if skipping successful, false otherwise