Package pixy.image.png
Class Chunk
java.lang.Object
pixy.image.png.Chunk
- All Implemented Interfaces:
java.lang.Comparable<Chunk>
- Direct Known Subclasses:
UnknownChunk
public class Chunk extends java.lang.Object implements java.lang.Comparable<Chunk>
Class for PNG chunks
- Version:
- 1.0 11/07/2012
- Author:
- Wen Yu, yuwen_66@yahoo.com
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description static longcalculateCRC(int chunkValue, byte[] data)static longcalculateCRC(int chunkValue, byte[] data, int offset, int length)intcompareTo(Chunk that)Compare different chunks according to their Attribute ranking.booleanequals(java.lang.Object that)ChunkTypegetChunkType()longgetCRC()byte[]getData()longgetLength()inthashCode()booleanisValidCRC()java.lang.StringtoString()voidwrite(java.io.OutputStream os)
-
Constructor Details
-
Method Details
-
compareTo
Compare different chunks according to their Attribute ranking. This is intended to be used for comparing chunks with different chunk types rather than chunks of the same chunkType which will always have the same ranking.- Specified by:
compareToin interfacejava.lang.Comparable<Chunk>
-
getChunkType
-
getLength
public long getLength() -
getData
public byte[] getData() -
getCRC
public long getCRC() -
isValidCRC
public boolean isValidCRC() -
write
public void write(java.io.OutputStream os) throws java.io.IOException- Throws:
java.io.IOException
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object that)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
calculateCRC
public static long calculateCRC(int chunkValue, byte[] data) -
calculateCRC
public static long calculateCRC(int chunkValue, byte[] data, int offset, int length)
-