Short lived object, to be created while serialing/deserializing Do not reuse
it for different chunks.
See http://www.libpng.org/pub/png/spec/1.2/PNG-Structure.html
| Modifier and Type | Field and Description |
|---|---|
| private int | crcval
A 4-byte CRC (Cyclic Redundancy Check) calculated on the preceding bytes in the chunk, including the chunk type code and chunk data fields, but not including the length field. |
| public byte[] | data
The data bytes appropriate to the chunk type, if any. |
| public final byte[] | idbytes
A 4-byte chunk type code. |
| public final int | len
The length counts only the data field, not itself, the chunk type code, or the CRC. |
| Access | Constructor and Description |
|---|---|
| public | ChunkRaw(final int
: data len len, final byte[] : chunk type (deep copied) idbytes, final boolean : it true, the data array will be allocced alloc)
|
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private int | |
| pack-priv ByteArrayInputStream | |
| public int | readChunkData(final InputStream is, final boolean checkCrc)
position before: just after chunk id. positon after: after crc Data should be already allocated. |
| public String | |
| public void |
| crcval | back to summary |
|---|---|
| private int crcval A 4-byte CRC (Cyclic Redundancy Check) calculated on the preceding bytes in the chunk, including the chunk type code and chunk data fields, but not including the length field. | |
| data | back to summary |
|---|---|
| public byte[] data The data bytes appropriate to the chunk type, if any. This field can be of zero length. Does not include crc | |
| idbytes | back to summary |
|---|---|
| public final byte[] idbytes A 4-byte chunk type code. uppercase and lowercase ASCII letters | |
| len | back to summary |
|---|---|
| public final int len The length counts only the data field, not itself, the chunk type code, or the CRC. Zero is a valid length. Although encoders and decoders should treat the length as unsigned, its value must not exceed 231-1 bytes. | |
| ChunkRaw | back to summary |
|---|---|
public ChunkRaw(final int len, final byte[] idbytes, final boolean alloc)
| |
| allocData | back to summary |
|---|---|
| private void allocData() | |
| computeCrc | back to summary |
|---|---|
| private int computeCrc() this is called after setting data, before writing to os | |
| getAsByteStream | back to summary |
|---|---|
| pack-priv ByteArrayInputStream getAsByteStream() | |
| readChunkData | back to summary |
|---|---|
| public int readChunkData(final InputStream is, final boolean checkCrc) position before: just after chunk id. positon after: after crc Data should be already allocated. Checks CRC Return number of byte read. | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| writeChunk | back to summary |
|---|---|
| public void writeChunk(final OutputStream os) Computes the CRC and writes to the stream. If error, a PngjOutputException is thrown | |