Class PNGChunk

    • Constructor Detail

      • PNGChunk

        public PNGChunk()
    • Method Detail

      • makePNGChunk

        public static PNGChunk makePNGChunk​(long length,
                                            int sig)
        Construct a PNGChunk object of the appropriate subtype based on the chunk type.
      • setNisoMetadata

        public void setNisoMetadata​(NisoImageMetadata nmd)
        Hand the chunk the NISO metadata object if it needs to put information into it.
      • setPropertyList

        public void setPropertyList​(List<Property> lst)
        Hand the main property list to the chunk
      • setModule

        public void setModule​(PngModule mdl)
        Give the chunk a reference to the PNG module.
      • setInputStream

        public void setInputStream​(DataInputStream dstrm)
        Give the chunk a reference to the data stream.
      • getLength

        public long getLength()
      • getChunkType

        public int getChunkType()
      • getChunkData

        public char[] getChunkData()
      • getCRC

        public long getCRC()
      • processChunk

        public void processChunk​(RepInfo info)
                          throws Exception
        Process a chunk. When this is called, the input stream needs to have read the type and length and be positioned at the start of the data. The default behavior is to eat the chunk. This should be the behavior only for UnknownChunk when we're done.
        Throws:
        Exception
      • processChunkCommon

        public void processChunkCommon​(RepInfo info)
                                throws PNGException
        Common code to call at the start of every processChunk method.
        Throws:
        PNGException
      • readUnsignedInt

        public long readUnsignedInt()
                             throws IOException
        Read a 4-byte unsigned integer and update the CRC
        Throws:
        IOException
      • readUnsignedShort

        public int readUnsignedShort()
                              throws IOException
        Read a 2-byte unsigned integer and update the CRC
        Throws:
        IOException
      • readUnsignedByte

        public int readUnsignedByte()
                             throws IOException
        Read a single byte and update the CRC
        Throws:
        IOException
      • skipBytes

        public void skipBytes​(int count)
                       throws IOException
        Skip over all the bytes, updating the CRC
        Throws:
        IOException
      • readCRC

        public long readCRC()
                     throws IOException
        Read the CRC itself. Naturally, this doesn't update the CRC.
        Throws:
        IOException
      • chunkTypeString

        public String chunkTypeString()