Top Description Inners Fields Constructors Methods
jogamp.opengl.util.pngj.chunks

public abstract Class PngChunk

extends Object
Class Inheritance
Known Direct Subclasses
jogamp.opengl.util.pngj.chunks.PngChunkMultiple, jogamp.opengl.util.pngj.chunks.PngChunkSingle, jogamp.opengl.util.pngj.chunks.PngChunkSkipped
Imports
java.io.OutputStream, java.lang.reflect.Constructor, java.util.HashMap, .Map, jogamp.opengl.util.pngj.ImageInfo, .PngjExceptionInternal

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 and Inner Type Summary

Modifier and TypeClass and Description
public static enum
PngChunk.ChunkOrderingConstraint

Possible ordering constraint for a PngChunk type -only relevant for ancillary chunks.

Field Summary

Modifier and TypeField and Description
protected int
public final boolean
crit

Autocomputed at creation time

private static final Map<String, Class<? extends PngChunk>>
factoryMap

This static map defines which PngChunk class correspond to which ChunkID

The client can add other chunks to this map statically, before reading an image, calling PngChunk.factoryRegister(id,class)

public final String
id

Chunk-id: 4 letters

protected final ImageInfo
protected int
protected long
private boolean
public final boolean
pub

Autocomputed at creation time

public final boolean
safe

Autocomputed at creation time

Constructor Summary

AccessConstructor and Description
protected
PngChunk(final String id, final ImageInfo imgInfo)

Method Summary

Modifier and TypeMethod and Description
public abstract boolean
public static <T extends PngChunk> T
cloneChunk(final T chunk, final ImageInfo info)

Makes a clone (deep copy) calling cloneDataFromRead(PngChunk)

public abstract void
cloneDataFromRead(PngChunk other)

Makes a copy of the chunk.

protected final ChunkRaw
createEmptyChunk(final int len, final boolean alloc)

public abstract ChunkRaw

Returns:

A newly allocated and filled raw chunk
createRawChunk
()

Creates the physical chunk.

public static PngChunk
factory(final ChunkRaw chunk, final ImageInfo info)

This factory creates the corresponding chunk and parses the raw chunk.

public static PngChunk
factoryFromId(final String cid, final ImageInfo info)

Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known)

public static void
factoryRegister(final String chunkId, final 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.

public final int
getChunkGroup()

In which "chunkGroup" (see ChunksListfor definition) this chunks instance was read or written.

public int
public long
public abstract PngChunk.ChunkOrderingConstraint
public boolean
public static boolean
isKnown(final String id)

True if the chunk-id type is known.

public abstract void
parseFromRaw(ChunkRaw c)

Parses raw chunk and fill inside data.

public final void
setChunkGroup(final int chunkGroup)

public void
setOffset(final long offset)

public void
setPriority(final boolean priority)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv final void
write(final OutputStream os)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

chunkGroupback to summary
protected int chunkGroup
critback to summary
public final boolean crit

Autocomputed at creation time

factoryMapback to summary
private static final Map<String, Class<? extends PngChunk>> factoryMap

This static map defines which PngChunk class correspond to which ChunkID

The client can add other chunks to this map statically, before reading an image, calling PngChunk.factoryRegister(id,class)

idback to summary
public final String id

Chunk-id: 4 letters

imgInfoback to summary
protected final ImageInfo imgInfo
lengthback to summary
protected int length
offsetback to summary
protected long offset
priorityback to summary
private boolean priority
pubback to summary
public final boolean pub

Autocomputed at creation time

safeback to summary
public final boolean safe

Autocomputed at creation time

Constructor Detail

PngChunkback to summary
protected PngChunk(final String id, final ImageInfo imgInfo)

Method Detail

allowsMultipleback to summary
public abstract boolean allowsMultiple()
cloneChunkback to summary
public static <T extends PngChunk> T cloneChunk(final T chunk, final ImageInfo info)

Makes a clone (deep copy) calling cloneDataFromRead(PngChunk)

Annotations
@SuppressWarnings:unchecked
cloneDataFromReadback to summary
public abstract void cloneDataFromRead(PngChunk other)

Makes a copy of the chunk.

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

createEmptyChunkback to summary
protected final ChunkRaw createEmptyChunk(final int len, final boolean alloc)
createRawChunkback to summary
public abstract ChunkRaw createRawChunk()

Creates the physical chunk. This is used when writing (serialization). Each particular chunk class implements its own logic.

Returns:ChunkRaw

A newly allocated and filled raw chunk

factoryback to summary
public static PngChunk factory(final ChunkRaw chunk, final ImageInfo info)

This factory creates the corresponding chunk and parses the raw chunk. This is used when reading.

factoryFromIdback to summary
public static PngChunk factoryFromId(final String cid, final ImageInfo info)

Creates one new blank chunk of the corresponding type, according to factoryMap (PngChunkUNKNOWN if not known)

factoryRegisterback to summary
public static void factoryRegister(final String chunkId, final 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.

getChunkGroupback to summary
public final int getChunkGroup()

In which "chunkGroup" (see ChunksListfor definition) this chunks instance was read or written.

-1 if not read or written (eg, queued)

getLengthback to summary
public int getLength()
getOffsetback to summary
public long getOffset()
getOrderingConstraintback to summary
public abstract PngChunk.ChunkOrderingConstraint getOrderingConstraint()

see ChunkOrderingConstraint

hasPriorityback to summary
public boolean hasPriority()
isKnownback to summary
public static boolean isKnown(final String id)

True if the chunk-id type is known.

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

parseFromRawback to summary
public abstract void parseFromRaw(ChunkRaw c)

Parses raw chunk and fill inside data. This is used when reading (deserialization). Each particular chunk class implements its own logic.

setChunkGroupback to summary
public final void setChunkGroup(final int chunkGroup)
See Also
getChunkGroup()
setOffsetback to summary
public void setOffset(final long offset)
setPriorityback to summary
public void setPriority(final boolean priority)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object

Annotations
@Override
writeback to summary
pack-priv final void write(final OutputStream os)
jogamp.opengl.util.pngj.chunks back to summary

public final Enum PngChunk.ChunkOrderingConstraint

extends Enum<PngChunk.ChunkOrderingConstraint>
Class Inheritance

Possible ordering constraint for a PngChunk type -only relevant for ancillary chunks. Theoretically, there could be more general constraints, but these cover the constraints for standard chunks.

Field Summary

Modifier and TypeField and Description
public static final PngChunk.ChunkOrderingConstraint
AFTER_PLTE_BEFORE_IDAT

Must go after PLTE but before IDAT

public static final PngChunk.ChunkOrderingConstraint
BEFORE_IDAT

Must before IDAT (before or after PLTE)

public static final PngChunk.ChunkOrderingConstraint
BEFORE_PLTE_AND_IDAT

Must go before PLTE (and hence, also before IDAT)

public static final PngChunk.ChunkOrderingConstraint
NA

Does not apply

public static final PngChunk.ChunkOrderingConstraint
NONE

no ordering constraint

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
public boolean
public boolean
public static PngChunk.ChunkOrderingConstraint
public static PngChunk.ChunkOrderingConstraint[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

AFTER_PLTE_BEFORE_IDATback to summary
public static final PngChunk.ChunkOrderingConstraint AFTER_PLTE_BEFORE_IDAT

Must go after PLTE but before IDAT

BEFORE_IDATback to summary
public static final PngChunk.ChunkOrderingConstraint BEFORE_IDAT

Must before IDAT (before or after PLTE)

BEFORE_PLTE_AND_IDATback to summary
public static final PngChunk.ChunkOrderingConstraint BEFORE_PLTE_AND_IDAT

Must go before PLTE (and hence, also before IDAT)

NAback to summary
public static final PngChunk.ChunkOrderingConstraint NA

Does not apply

NONEback to summary
public static final PngChunk.ChunkOrderingConstraint NONE

no ordering constraint

Constructor Detail

ChunkOrderingConstraintback to summary
private ChunkOrderingConstraint()

Method Detail

mustGoAfterPLTEback to summary
public boolean mustGoAfterPLTE()
mustGoBeforeIDATback to summary
public boolean mustGoBeforeIDAT()
mustGoBeforePLTEback to summary
public boolean mustGoBeforePLTE()
valueOfback to summary
public static PngChunk.ChunkOrderingConstraint valueOf(String name)
valuesback to summary
public static PngChunk.ChunkOrderingConstraint[] values()