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 long
calculateCRC(int chunkValue, byte[] data)
static long
calculateCRC(int chunkValue, byte[] data, int offset, int length)
int
compareTo(Chunk that)
Compare different chunks according to their Attribute ranking.boolean
equals(java.lang.Object that)
ChunkType
getChunkType()
long
getCRC()
byte[]
getData()
long
getLength()
int
hashCode()
boolean
isValidCRC()
java.lang.String
toString()
void
write(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:
compareTo
in 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:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object that)- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in 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)
-