class PngChunk
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static int |
CHUNK_IDAT |
(package private) static int |
CHUNK_IEND |
(package private) static int |
CHUNK_IHDR |
(package private) static int |
CHUNK_PLTE |
(package private) static int |
CHUNK_tRNS |
(package private) static int |
CHUNK_UNKNOWN |
(package private) static int[] |
CRC_TABLE |
(package private) static int |
DATA_OFFSET |
(package private) int |
length |
(package private) static int |
LENGTH_FIELD_LENGTH |
(package private) static int |
LENGTH_OFFSET |
(package private) static int |
MIN_LENGTH |
(package private) byte[] |
reference |
(package private) static int |
TYPE_FIELD_LENGTH |
(package private) static byte[] |
TYPE_IDAT |
(package private) static byte[] |
TYPE_IEND |
(package private) static byte[] |
TYPE_IHDR |
(package private) static int |
TYPE_OFFSET |
(package private) static byte[] |
TYPE_PLTE |
(package private) static byte[] |
TYPE_tRNS |
Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
checkCRC()
Compute the CRC value for the chunk's data.
|
(package private) int |
computeCRC()
Answer the CRC value of chunk's data.
|
(package private) void |
contributeToString(java.lang.StringBuffer buffer)
Provided so that subclasses can override and add
data to the toString() call.
|
(package private) int |
getChunkType() |
(package private) int |
getCRC()
Get the CRC value for the chunk's data.
|
(package private) byte[] |
getData()
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 |
getLength()
Get the length of the data component of this chunk.
|
(package private) byte[] |
getReference()
Get the PngChunk's reference byteArray;
|
(package private) int |
getSize()
Get the chunk's total size including the length, type, and crc fields.
|
(package private) byte[] |
getTypeBytes()
Get the chunk type.
|
(package private) boolean |
isCritical() |
(package private) static PngChunk |
readNextFromStream(LEDataInputStream stream)
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.
|
java.lang.String |
toString()
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.
|
byte[] reference
static final int LENGTH_OFFSET
static final int TYPE_OFFSET
static final int DATA_OFFSET
static final int TYPE_FIELD_LENGTH
static final int LENGTH_FIELD_LENGTH
static final int MIN_LENGTH
static final int CHUNK_UNKNOWN
static final int CHUNK_IHDR
static final int CHUNK_PLTE
static final int CHUNK_IDAT
static final int CHUNK_IEND
static final int CHUNK_tRNS
static final byte[] TYPE_IHDR
static final byte[] TYPE_PLTE
static final byte[] TYPE_IDAT
static final byte[] TYPE_IEND
static final byte[] TYPE_tRNS
static final int[] CRC_TABLE
int length
PngChunk(byte[] reference)
PngChunk(int dataLength)
byte[] getReference()
void setReference(byte[] reference)
int getInt16(int offset)
void setInt16(int offset, int value)
int getInt32(int offset)
void setInt32(int offset, int value)
int getLength()
void setLength(int value)
byte[] getTypeBytes()
void setType(byte[] value)
byte[] getData()
void setData(byte[] data)
int getCRC()
void setCRC(int value)
int getSize()
boolean checkCRC()
int computeCRC()
boolean typeMatchesArray(byte[] array)
boolean isCritical()
int getChunkType()
static PngChunk readNextFromStream(LEDataInputStream stream)
void validate(PngFileReadState readState, PngIhdrChunk headerChunk)
void contributeToString(java.lang.StringBuffer buffer)
public java.lang.String toString()
toString
in class java.lang.Object