|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectar.com.hjg.pngj.chunks.PngChunk
public abstract class PngChunk
Represents a instance of a PNG chunk
See http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks .html
Concrete classes should extend PngChunkSingle
or PngChunkMultiple
Note that some methods/fields are type-specific (getOrderingConstraint(), allowsMultiple()),
some are 'almost' type-specific (id,crit,pub,safe; the exception is PngUKNOWN),
and the rest are instance-specific
Nested Class Summary | |
---|---|
static class |
PngChunk.ChunkOrderingConstraint
Possible ordering constraint for a PngChunk type -only relevant for ancillary chunks. |
Field Summary | |
---|---|
boolean |
crit
Autocomputed at creation time |
String |
id
Chunk-id: 4 letters |
boolean |
pub
Autocomputed at creation time |
boolean |
safe
Autocomputed at creation time |
Method Summary | ||
---|---|---|
abstract boolean |
allowsMultiple()
|
|
static
|
cloneChunk(T chunk,
ImageInfo info)
Makes a clone (deep copy) calling cloneDataFromRead(PngChunk) |
|
abstract void |
cloneDataFromRead(PngChunk other)
Makes a copy of the chunk. |
|
abstract ChunkRaw |
createRawChunk()
Creates the physical chunk. |
|
static PngChunk |
factory(ChunkRaw chunk,
ImageInfo info)
This factory creates the corresponding chunk and parses the raw chunk. |
|
static PngChunk |
factoryFromId(String cid,
ImageInfo info)
Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known) |
|
static void |
factoryRegister(String chunkId,
Class<? extends PngChunk> chunkClass)
Registers a chunk-id (4 letters) to be associated with a PngChunk class This method should be called by user code that wants to add some chunks (not implmemented in this library) to the factory, so that the PngReader knows about it. |
|
int |
getChunkGroup()
In which "chunkGroup" (see ChunksList for definition) this chunks instance was read or written. |
|
abstract PngChunk.ChunkOrderingConstraint |
getOrderingConstraint()
see PngChunk.ChunkOrderingConstraint |
|
boolean |
hasPriority()
|
|
static boolean |
isKnown(String id)
True if the chunk-id type is known. |
|
abstract void |
parseFromRaw(ChunkRaw c)
Parses raw chunk and fill inside data. |
|
void |
setChunkGroup(int chunkGroup)
|
|
void |
setPriority(boolean priority)
|
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final boolean crit
public final String id
public final boolean pub
public final boolean safe
Method Detail |
---|
public abstract boolean allowsMultiple()
public static <T extends PngChunk> T cloneChunk(T chunk, ImageInfo info)
cloneDataFromRead(PngChunk)
public abstract void cloneDataFromRead(PngChunk other)
This is used when copying chunks from a reader to a writer
It should normally be a deep copy, and after the cloning this.equals(other) should return true
public abstract ChunkRaw createRawChunk()
public static PngChunk factory(ChunkRaw chunk, ImageInfo info)
public static PngChunk factoryFromId(String cid, ImageInfo info)
public static void factoryRegister(String chunkId, Class<? extends PngChunk> chunkClass)
This method should be called by user code that wants to add some chunks (not implmemented in this library) to the factory, so that the PngReader knows about it.
public final int getChunkGroup()
ChunksList
for definition) this chunks instance was read or written.
-1 if not read or written (eg, queued)
public abstract PngChunk.ChunkOrderingConstraint getOrderingConstraint()
PngChunk.ChunkOrderingConstraint
public boolean hasPriority()
public static boolean isKnown(String id)
A chunk is known if we recognize its class, according with factoryMap
This is not necessarily the same as being "STANDARD", or being implemented in this library
Unknown chunks will be parsed as instances of PngChunkUNKNOWN
public abstract void parseFromRaw(ChunkRaw c)
public final void setChunkGroup(int chunkGroup)
getChunkGroup()
public void setPriority(boolean priority)
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |