Package com.mcgath.jhove.module.png
Class PNGChunk
java.lang.Object
com.mcgath.jhove.module.png.PNGChunk
- Direct Known Subclasses:
BkgdChunk,ChrmChunk,GamaChunk,GeneralTextChunk,HistChunk,IccpChunk,IdatChunk,IendChunk,IhdrChunk,PhysChunk,PlteChunk,SbitChunk,SpltChunk,SrgbChunk,TimeChunk,TrnsChunk,UnknownChunk
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DataInputStreamThe invoking module's input streamprotected PngModuleThe invoking moduleprotected NisoImageMetadataprotected booleanprotected static final intprotected static final intprotected char[]protected intprotected CRC32protected booleanprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected longprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final intprotected static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchar[]intlonggetCRC()longstatic PNGChunkmakePNGChunk(long length, int sig) Construct a PNGChunk object of the appropriate subtype based on the chunk type.voidprocessChunk(RepInfo info) Process a chunk.voidprocessChunkCommon(RepInfo info) Common code to call at the start of every processChunk method.longreadCRC()Read the CRC itself.intRead a single byte and update the CRClongRead a 4-byte unsigned integer and update the CRCintRead a 2-byte unsigned integer and update the CRCvoidsetInputStream(DataInputStream dstrm) Give the chunk a reference to the data stream.voidGive the chunk a reference to the PNG module.voidHand the chunk the NISO metadata object if it needs to put information into it.voidsetPropertyList(List<Property> lst) Hand the main property list to the chunkvoidskipBytes(int count) Skip over all the bytes, updating the CRC
-
Field Details
-
length
protected long length -
chunkType
protected int chunkType -
chunkData
protected char[] chunkData -
crc
-
ancillary
protected boolean ancillary -
duplicateAllowed
protected boolean duplicateAllowed -
_nisoMetadata
-
_module
The invoking module -
_dstream
The invoking module's input stream -
_propList
-
IHDR_HEAD_SIG
protected static final int IHDR_HEAD_SIG- See Also:
-
PLTE_HEAD_SIG
protected static final int PLTE_HEAD_SIG- See Also:
-
IDAT_HEAD_SIG
protected static final int IDAT_HEAD_SIG- See Also:
-
IEND_HEAD_SIG
protected static final int IEND_HEAD_SIG- See Also:
-
cHRM_HEAD_SIG
protected static final int cHRM_HEAD_SIG- See Also:
-
gAMA_HEAD_SIG
protected static final int gAMA_HEAD_SIG- See Also:
-
iCCP_HEAD_SIG
protected static final int iCCP_HEAD_SIG- See Also:
-
sBIT_HEAD_SIG
protected static final int sBIT_HEAD_SIG- See Also:
-
sRGB_HEAD_SIG
protected static final int sRGB_HEAD_SIG- See Also:
-
tEXt_HEAD_SIG
protected static final int tEXt_HEAD_SIG- See Also:
-
zTXt_HEAD_SIG
protected static final int zTXt_HEAD_SIG- See Also:
-
iTXt_HEAD_SIG
protected static final int iTXt_HEAD_SIG- See Also:
-
bKGD_HEAD_SIG
protected static final int bKGD_HEAD_SIG- See Also:
-
hIST_HEAD_SIG
protected static final int hIST_HEAD_SIG- See Also:
-
pHYs_HEAD_SIG
protected static final int pHYs_HEAD_SIG- See Also:
-
sPLT_HEAD_SIG
protected static final int sPLT_HEAD_SIG- See Also:
-
tIME_HEAD_SIG
protected static final int tIME_HEAD_SIG- See Also:
-
tRNS_HEAD_SIG
protected static final int tRNS_HEAD_SIG- See Also:
-
-
Constructor Details
-
PNGChunk
public PNGChunk()
-
-
Method Details
-
makePNGChunk
Construct a PNGChunk object of the appropriate subtype based on the chunk type. -
setNisoMetadata
Hand the chunk the NISO metadata object if it needs to put information into it. -
setPropertyList
Hand the main property list to the chunk -
setModule
Give the chunk a reference to the PNG module. -
setInputStream
Give the chunk a reference to the data stream. -
getLength
public long getLength() -
getChunkType
public int getChunkType() -
getChunkData
public char[] getChunkData() -
getCRC
public long getCRC() -
processChunk
Process a chunk. When this is called, the input stream needs to have read the type and length and be positioned at the start of the data. The default behavior is to eat the chunk. This should be the behavior only for UnknownChunk when we're done.- Throws:
Exception
-
processChunkCommon
Common code to call at the start of every processChunk method.- Throws:
PNGException
-
readUnsignedInt
Read a 4-byte unsigned integer and update the CRC- Throws:
IOException
-
readUnsignedShort
Read a 2-byte unsigned integer and update the CRC- Throws:
IOException
-
readUnsignedByte
Read a single byte and update the CRC- Throws:
IOException
-
skipBytes
Skip over all the bytes, updating the CRC- Throws:
IOException
-
readCRC
Read the CRC itself. Naturally, this doesn't update the CRC.- Throws:
IOException
-
chunkTypeString
-