Class PngChunk
java.lang.Object
org.apache.commons.imaging.common.BinaryFileParser
org.apache.commons.imaging.formats.png.chunks.PngChunk
- Direct Known Subclasses:
PngChunkGama,PngChunkIccp,PngChunkIdat,PngChunkIhdr,PngChunkPhys,PngChunkPlte,PngChunkScal,PngTextChunk
A PNG image is composed of several chunks. This is the base class for the chunks,
used by the parser.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanprivate final byte[]final intfinal intfinal booleanfinal intprivate final boolean[]final booleanfinal boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]getBytes()Return a copy of the chunk bytes.protected ByteArrayInputStreamCreate and return aByteArrayInputStreamfor the chunk bytes.boolean[]Return a copy of the chunk property bits.Methods inherited from class org.apache.commons.imaging.common.BinaryFileParser
debugNumber, debugNumber, getByteOrder, setByteOrder
-
Field Details
-
length
public final int length -
chunkType
public final int chunkType -
crc
public final int crc -
bytes
private final byte[] bytes -
propertyBits
private final boolean[] propertyBits -
ancillary
public final boolean ancillary -
isPrivate
public final boolean isPrivate -
reserved
public final boolean reserved -
safeToCopy
public final boolean safeToCopy
-
-
Constructor Details
-
PngChunk
public PngChunk(int length, int chunkType, int crc, byte[] bytes) Constructor.- Parameters:
length- chunk lengthchunkType- chunk typecrc- CRC computed over the chunk type and chunk data (but not the length)bytes- chunk data bytes
-
-
Method Details
-
getBytes
public byte[] getBytes()Return a copy of the chunk bytes.- Returns:
- the chunk bytes
-
getPropertyBits
public boolean[] getPropertyBits()Return a copy of the chunk property bits.- Returns:
- the chunk property bits
-
getDataStream
Create and return aByteArrayInputStreamfor the chunk bytes.The caller is responsible for closing the resource.
- Returns:
- a ByteArrayInputStream for the chunk bytes
-