Class PngChunk

java.lang.Object
org.eclipse.swt.internal.image.PngChunk
Direct Known Subclasses:
PngIdatChunk, PngIendChunk, PngIhdrChunk, PngPlteChunk, PngTrnsChunk

class PngChunk extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int[]
     
    (package private) static final int
     
    (package private) int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) static final int
     
    (package private) byte[]
     
    (package private) static final int
     
    (package private) static final byte[]
     
    (package private) static final byte[]
     
    (package private) static final byte[]
     
    (package private) static final int
     
    (package private) static final byte[]
     
    (package private) static final byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PngChunk(byte[] reference)
    Construct a PngChunk using the reference bytes given.
    PngChunk(int dataLength)
    Construct a PngChunk with the specified number of data bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) boolean
    Compute the CRC value for the chunk's data.
    (package private) int
    Answer the CRC value of chunk's data.
    (package private) void
    Provided so that subclasses can override and add data to the toString() call.
    (package private) int
     
    (package private) int
    Get the CRC value for the chunk's data.
    (package private) byte[]
    Get the chunk's data.
    (package private) int
    getInt16(int offset)
    Get the 16-bit integer from the reference byte array at the given offset.
    (package private) int
    getInt32(int offset)
    Get the 32-bit integer from the reference byte array at the given offset.
    (package private) int
    Get the length of the data component of this chunk.
    (package private) byte[]
    Get the PngChunk's reference byteArray;
    (package private) int
    Get the chunk's total size including the length, type, and crc fields.
    (package private) byte[]
    Get the chunk type.
    (package private) boolean
     
    (package private) static PngChunk
    Read the next PNG chunk from the input stream given.
    (package private) void
    setCRC(int value)
    Set the CRC value for the chunk's data.
    (package private) void
    setData(byte[] data)
    Set the chunk's data.
    (package private) void
    setInt16(int offset, int value)
    Set the 16-bit integer in the reference byte array at the given offset.
    (package private) void
    setInt32(int offset, int value)
    Set the 32-bit integer in the reference byte array at the given offset.
    (package private) void
    setLength(int value)
    Set the length of the data component of this chunk.
    (package private) void
    setReference(byte[] reference)
    Set the PngChunk's reference byteArray;
    (package private) void
    setType(byte[] value)
    Set the chunk type.
    Returns a string containing a concise, human-readable description of the receiver.
    (package private) boolean
    typeMatchesArray(byte[] array)
     
    (package private) void
    validate(PngFileReadState readState, PngIhdrChunk headerChunk)
    Answer whether the chunk is a valid PNG chunk.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • PngChunk

      PngChunk(byte[] reference)
      Construct a PngChunk using the reference bytes given.
    • PngChunk

      PngChunk(int dataLength)
      Construct a PngChunk with the specified number of data bytes.
  • Method Details

    • getReference

      byte[] getReference()
      Get the PngChunk's reference byteArray;
    • setReference

      void setReference(byte[] reference)
      Set the PngChunk's reference byteArray;
    • getInt16

      int getInt16(int offset)
      Get the 16-bit integer from the reference byte array at the given offset.
    • setInt16

      void setInt16(int offset, int value)
      Set the 16-bit integer in the reference byte array at the given offset.
    • getInt32

      int getInt32(int offset)
      Get the 32-bit integer from the reference byte array at the given offset.
    • setInt32

      void setInt32(int offset, int value)
      Set the 32-bit integer in the reference byte array at the given offset.
    • getLength

      int getLength()
      Get the length of the data component of this chunk. This is not the length of the entire chunk.
    • setLength

      void setLength(int value)
      Set the length of the data component of this chunk. This is not the length of the entire chunk.
    • getTypeBytes

      byte[] getTypeBytes()
      Get the chunk type. This is a four byte value. Each byte should be an ASCII character. The first byte is upper case if the chunk is critical. The second byte is upper case if the chunk is publicly defined. The third byte must be upper case. The fourth byte is upper case if the chunk is unsafe to copy. Public chunk types are defined by the PNG Development Group.
    • setType

      void setType(byte[] value)
      Set the chunk type. This is a four byte value. Each byte should be an ASCII character. The first byte is upper case if the chunk is critical. The second byte is upper case if the chunk is publicly defined. The third byte must be upper case. The fourth byte is upper case if the chunk is unsafe to copy. Public chunk types are defined by the PNG Development Group.
    • getData

      byte[] getData()
      Get the chunk's data.
    • setData

      void setData(byte[] data)
      Set the chunk's data. This method has two side-effects. 1. It will set the length field to be the length of the data array given. 2. It will set the CRC field to the computed CRC value of the data array given.
    • getCRC

      int getCRC()
      Get the CRC value for the chunk's data. Ensure that the length field has a good value before making this call.
    • setCRC

      void setCRC(int value)
      Set the CRC value for the chunk's data. Ensure that the length field has a good value before making this call.
    • getSize

      int getSize()
      Get the chunk's total size including the length, type, and crc fields.
    • checkCRC

      boolean checkCRC()
      Compute the CRC value for the chunk's data. Answer whether this value matches the value stored in the chunk.
    • computeCRC

      int computeCRC()
      Answer the CRC value of chunk's data.
    • typeMatchesArray

      boolean typeMatchesArray(byte[] array)
    • isCritical

      boolean isCritical()
    • getChunkType

      int getChunkType()
    • readNextFromStream

      static PngChunk readNextFromStream(LEDataInputStream stream)
      Read the next PNG chunk from the input stream given. If unable to read a chunk, return null.
    • validate

      void validate(PngFileReadState readState, PngIhdrChunk headerChunk)
      Answer whether the chunk is a valid PNG chunk.
    • contributeToString

      void contributeToString(StringBuilder buffer)
      Provided so that subclasses can override and add data to the toString() call.
    • toString

      public String toString()
      Returns a string containing a concise, human-readable description of the receiver.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the event