Package com.mcgath.jhove.module.png
Class PNGChunk
- java.lang.Object
-
- com.mcgath.jhove.module.png.PNGChunk
-
-
Field Summary
Fields Modifier and Type Field Description protected DataInputStream_dstreamThe invoking module's input streamprotected PngModule_moduleThe invoking moduleprotected NisoImageMetadata_nisoMetadataprotected List<Property>_propListprotected booleanancillaryprotected static intbKGD_HEAD_SIGprotected static intcHRM_HEAD_SIGprotected char[]chunkDataprotected intchunkTypeprotected CRC32crcprotected booleanduplicateAllowedprotected static intgAMA_HEAD_SIGprotected static inthIST_HEAD_SIGprotected static intiCCP_HEAD_SIGprotected static intIDAT_HEAD_SIGprotected static intIEND_HEAD_SIGprotected static intIHDR_HEAD_SIGprotected static intiTXt_HEAD_SIGprotected longlengthprotected static intpHYs_HEAD_SIGprotected static intPLTE_HEAD_SIGprotected static intsBIT_HEAD_SIGprotected static intsPLT_HEAD_SIGprotected static intsRGB_HEAD_SIGprotected static inttEXt_HEAD_SIGprotected static inttIME_HEAD_SIGprotected static inttRNS_HEAD_SIGprotected static intzTXt_HEAD_SIG
-
Constructor Summary
Constructors Constructor Description PNGChunk()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringchunkTypeString()char[]getChunkData()intgetChunkType()longgetCRC()longgetLength()static 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.intreadUnsignedByte()Read a single byte and update the CRClongreadUnsignedInt()Read a 4-byte unsigned integer and update the CRCintreadUnsignedShort()Read a 2-byte unsigned integer and update the CRCvoidsetInputStream(DataInputStream dstrm)Give the chunk a reference to the data stream.voidsetModule(PngModule mdl)Give the chunk a reference to the PNG module.voidsetNisoMetadata(NisoImageMetadata nmd)Hand 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 Detail
-
length
protected long length
-
chunkType
protected int chunkType
-
chunkData
protected char[] chunkData
-
crc
protected CRC32 crc
-
ancillary
protected boolean ancillary
-
duplicateAllowed
protected boolean duplicateAllowed
-
_nisoMetadata
protected NisoImageMetadata _nisoMetadata
-
_module
protected PngModule _module
The invoking module
-
_dstream
protected DataInputStream _dstream
The invoking module's input stream
-
IHDR_HEAD_SIG
protected static final int IHDR_HEAD_SIG
- See Also:
- Constant Field Values
-
PLTE_HEAD_SIG
protected static final int PLTE_HEAD_SIG
- See Also:
- Constant Field Values
-
IDAT_HEAD_SIG
protected static final int IDAT_HEAD_SIG
- See Also:
- Constant Field Values
-
IEND_HEAD_SIG
protected static final int IEND_HEAD_SIG
- See Also:
- Constant Field Values
-
cHRM_HEAD_SIG
protected static final int cHRM_HEAD_SIG
- See Also:
- Constant Field Values
-
gAMA_HEAD_SIG
protected static final int gAMA_HEAD_SIG
- See Also:
- Constant Field Values
-
iCCP_HEAD_SIG
protected static final int iCCP_HEAD_SIG
- See Also:
- Constant Field Values
-
sBIT_HEAD_SIG
protected static final int sBIT_HEAD_SIG
- See Also:
- Constant Field Values
-
sRGB_HEAD_SIG
protected static final int sRGB_HEAD_SIG
- See Also:
- Constant Field Values
-
tEXt_HEAD_SIG
protected static final int tEXt_HEAD_SIG
- See Also:
- Constant Field Values
-
zTXt_HEAD_SIG
protected static final int zTXt_HEAD_SIG
- See Also:
- Constant Field Values
-
iTXt_HEAD_SIG
protected static final int iTXt_HEAD_SIG
- See Also:
- Constant Field Values
-
bKGD_HEAD_SIG
protected static final int bKGD_HEAD_SIG
- See Also:
- Constant Field Values
-
hIST_HEAD_SIG
protected static final int hIST_HEAD_SIG
- See Also:
- Constant Field Values
-
pHYs_HEAD_SIG
protected static final int pHYs_HEAD_SIG
- See Also:
- Constant Field Values
-
sPLT_HEAD_SIG
protected static final int sPLT_HEAD_SIG
- See Also:
- Constant Field Values
-
tIME_HEAD_SIG
protected static final int tIME_HEAD_SIG
- See Also:
- Constant Field Values
-
tRNS_HEAD_SIG
protected static final int tRNS_HEAD_SIG
- See Also:
- Constant Field Values
-
-
Method Detail
-
makePNGChunk
public static PNGChunk makePNGChunk(long length, int sig)
Construct a PNGChunk object of the appropriate subtype based on the chunk type.
-
setNisoMetadata
public void setNisoMetadata(NisoImageMetadata nmd)
Hand the chunk the NISO metadata object if it needs to put information into it.
-
setPropertyList
public void setPropertyList(List<Property> lst)
Hand the main property list to the chunk
-
setModule
public void setModule(PngModule mdl)
Give the chunk a reference to the PNG module.
-
setInputStream
public void setInputStream(DataInputStream dstrm)
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
public void processChunk(RepInfo info) throws Exception
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
public void processChunkCommon(RepInfo info) throws PNGException
Common code to call at the start of every processChunk method.- Throws:
PNGException
-
readUnsignedInt
public long readUnsignedInt() throws IOExceptionRead a 4-byte unsigned integer and update the CRC- Throws:
IOException
-
readUnsignedShort
public int readUnsignedShort() throws IOExceptionRead a 2-byte unsigned integer and update the CRC- Throws:
IOException
-
readUnsignedByte
public int readUnsignedByte() throws IOExceptionRead a single byte and update the CRC- Throws:
IOException
-
skipBytes
public void skipBytes(int count) throws IOExceptionSkip over all the bytes, updating the CRC- Throws:
IOException
-
readCRC
public long readCRC() throws IOExceptionRead the CRC itself. Naturally, this doesn't update the CRC.- Throws:
IOException
-
chunkTypeString
public String chunkTypeString()
-
-