Class PngChunk
java.lang.Object
org.eclipse.swt.internal.image.PngChunk
- Direct Known Subclasses:
PngIdatChunk, PngIendChunk, PngIhdrChunk, PngPlteChunk, PngTrnsChunk
-
Field Summary
FieldsModifier and TypeFieldDescription(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 -
Method Summary
Modifier and TypeMethodDescription(package private) booleancheckCRC()Compute the CRC value for the chunk's data.(package private) intAnswer the CRC value of chunk's data.(package private) voidcontributeToString(StringBuilder buffer) Provided so that subclasses can override and add data to the toString() call.(package private) int(package private) intgetCRC()Get the CRC value for the chunk's data.(package private) byte[]getData()Get the chunk's data.(package private) intgetInt16(int offset) Get the 16-bit integer from the reference byte array at the given offset.(package private) intgetInt32(int offset) Get the 32-bit integer from the reference byte array at the given offset.(package private) intGet the length of the data component of this chunk.(package private) byte[]Get the PngChunk's reference byteArray;(package private) intgetSize()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 PngChunkreadNextFromStream(LEDataInputStream stream) Read the next PNG chunk from the input stream given.(package private) voidsetCRC(int value) Set the CRC value for the chunk's data.(package private) voidsetData(byte[] data) Set the chunk's data.(package private) voidsetInt16(int offset, int value) Set the 16-bit integer in the reference byte array at the given offset.(package private) voidsetInt32(int offset, int value) Set the 32-bit integer in the reference byte array at the given offset.(package private) voidsetLength(int value) Set the length of the data component of this chunk.(package private) voidsetReference(byte[] reference) Set the PngChunk's reference byteArray;(package private) voidsetType(byte[] value) Set the chunk type.toString()Returns a string containing a concise, human-readable description of the receiver.(package private) booleantypeMatchesArray(byte[] array) (package private) voidvalidate(PngFileReadState readState, PngIhdrChunk headerChunk) Answer whether the chunk is a valid PNG chunk.
-
Field Details
-
reference
byte[] reference -
LENGTH_OFFSET
static final int LENGTH_OFFSET- See Also:
-
TYPE_OFFSET
static final int TYPE_OFFSET- See Also:
-
DATA_OFFSET
static final int DATA_OFFSET- See Also:
-
TYPE_FIELD_LENGTH
static final int TYPE_FIELD_LENGTH- See Also:
-
LENGTH_FIELD_LENGTH
static final int LENGTH_FIELD_LENGTH- See Also:
-
MIN_LENGTH
static final int MIN_LENGTH- See Also:
-
CHUNK_UNKNOWN
static final int CHUNK_UNKNOWN- See Also:
-
CHUNK_IHDR
static final int CHUNK_IHDR- See Also:
-
CHUNK_PLTE
static final int CHUNK_PLTE- See Also:
-
CHUNK_IDAT
static final int CHUNK_IDAT- See Also:
-
CHUNK_IEND
static final int CHUNK_IEND- See Also:
-
CHUNK_tRNS
static final int CHUNK_tRNS- See Also:
-
TYPE_IHDR
static final byte[] TYPE_IHDR -
TYPE_PLTE
static final byte[] TYPE_PLTE -
TYPE_IDAT
static final byte[] TYPE_IDAT -
TYPE_IEND
static final byte[] TYPE_IEND -
TYPE_tRNS
static final byte[] TYPE_tRNS -
CRC_TABLE
static final int[] CRC_TABLE -
length
int length
-
-
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
Read the next PNG chunk from the input stream given. If unable to read a chunk, return null. -
validate
Answer whether the chunk is a valid PNG chunk. -
contributeToString
Provided so that subclasses can override and add data to the toString() call. -
toString
-