public class ChunkSeqReaderPng extends ChunkSeqReader
Most usual PNG reading should use this class, or a PngReader, which
is a thin wrapper over this.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
callbackMode |
protected ChunksList |
chunksList
All chunks, but some of them can have the buffer empty (IDAT and skipped)
|
protected int |
currentChunkGroup |
protected ar.com.hjg.pngj.Deinterlacer |
deinterlacer |
protected ImageInfo |
imageInfo |
SIGNATURE_LEN, withSignature| Constructor and Description |
|---|
ChunkSeqReaderPng(boolean callbackMode) |
| Modifier and Type | Method and Description |
|---|---|
void |
addChunkToSkip(String chunkToSkip) |
void |
close()
Forces a closing (abort)
|
int |
consume(byte[] buf,
int off,
int len)
Consumes (in general, partially) a number of bytes.
|
protected DeflatedChunksSet |
createIdatSet(String id)
check that the last inserted chunk had the correct ordering
|
boolean |
firstChunksNotYetRead() |
long |
getBytesChunksLoaded() |
List<PngChunk> |
getChunks() |
Set<String> |
getChunksToSkip() |
int |
getCurrentChunkGroup() |
ar.com.hjg.pngj.Deinterlacer |
getDeinterlacer() |
IdatSet |
getIdatSet() |
ImageInfo |
getImageInfo() |
long |
getMaxBytesMetadata() |
long |
getMaxTotalBytesRead() |
long |
getSkipChunkMaxSize() |
boolean |
isCallbackMode() |
boolean |
isCheckCrc() |
protected boolean |
isIdatKind(String id)
Decides if this Chunk is of "IDAT" kind (in concrete: if it is, and if
it's not to be skiped, a DeflatedChunksSet will be created to deflate it
and process+ the deflated data)
This implementation return false.
|
boolean |
isInterlaced() |
protected void |
postProcessChunk(ChunkReader chunkR)
This is called after a chunk is read, in all modes.
|
protected void |
processEndPng()
Things to be done after IEND processing.
|
void |
setCheckCrc(boolean checkCrc) |
void |
setChunkFactory(IChunkFactory chunkFactory)
sets a custom chunk factory.
|
void |
setChunkLoadBehaviour(ChunkLoadBehaviour chunkLoadBehaviour) |
void |
setChunksToSkip(String... chunksToSkip) |
void |
setIncludeNonBufferedChunks(boolean includeNonBufferedChunks)
If true, the chunks with no data (because skipped or because processed
like IDAT-type) are still stored in the PngChunks list, which might be
more informative.
|
void |
setMaxBytesMetadata(long maxBytesMetadata) |
void |
setMaxTotalBytesRead(long maxTotalBytesRead) |
void |
setSkipChunkMaxSize(long skipChunkMaxSize) |
protected boolean |
shouldCheckCrc(int len,
String id) |
boolean |
shouldSkipContent(int len,
String id)
Chunks can be skipped depending on id and/or length.
|
protected void |
startNewChunk(int len,
String id,
long offset)
Called when a chunk start has been read (id and length), before the chunk
data itself is read.
|
checkSignature, endChunkId, feedAll, firstChunkId, getBytesCount, getChunkCount, getCurChunkReader, getCurReaderDeflatedSet, isAtChunkBoundary, isDone, isSignatureDoneprotected ImageInfo imageInfo
protected ar.com.hjg.pngj.Deinterlacer deinterlacer
protected int currentChunkGroup
protected ChunksList chunksList
protected final boolean callbackMode
public boolean shouldSkipContent(int len,
String id)
ChunkSeqReadershouldSkipContent in class ChunkSeqReaderpublic long getBytesChunksLoaded()
public int getCurrentChunkGroup()
public void setChunksToSkip(String... chunksToSkip)
public void addChunkToSkip(String chunkToSkip)
public boolean firstChunksNotYetRead()
protected void postProcessChunk(ChunkReader chunkR)
ChunkSeqReaderpostProcessChunk in class ChunkSeqReaderprotected DeflatedChunksSet createIdatSet(String id)
createIdatSet in class ChunkSeqReaderpublic IdatSet getIdatSet()
protected boolean isIdatKind(String id)
ChunkSeqReaderisIdatKind in class ChunkSeqReaderpublic int consume(byte[] buf,
int off,
int len)
ChunkSeqReaderChunkSeqReader.startNewChunk(int, String, long)
When data from a chunk is being read, it delegates to
ChunkReader.feedBytes(byte[], int, int)
The caller might want to call this method more than once in succesion
This should rarely be overridenconsume in interface IBytesConsumerconsume in class ChunkSeqReaderoff - Offset in bufferlen - Valid bytes that can be consumedpublic void setChunkFactory(IChunkFactory chunkFactory)
chunkFactory - protected void processEndPng()
public ImageInfo getImageInfo()
public boolean isInterlaced()
public ar.com.hjg.pngj.Deinterlacer getDeinterlacer()
protected void startNewChunk(int len,
String id,
long offset)
ChunkSeqReaderChunkSeqReader.getCurChunkReader()) in the corresponding mode, and eventually a
curReaderDeflatedSet.(field accesible via
ChunkSeqReader.getCurReaderDeflatedSet())
To decide the mode and options, it calls
ChunkSeqReader.shouldCheckCrc(int, String),
ChunkSeqReader.shouldSkipContent(int, String), ChunkSeqReader.isIdatKind(String).
Those methods should be overriden in preference to this.
The respective ChunkReader.chunkDone() method is directed to this
ChunkSeqReader.postProcessChunk(ChunkReader).startNewChunk in class ChunkSeqReaderpublic void close()
ChunkSeqReaderclose in class ChunkSeqReaderpublic void setMaxTotalBytesRead(long maxTotalBytesRead)
public long getSkipChunkMaxSize()
public void setSkipChunkMaxSize(long skipChunkMaxSize)
public long getMaxBytesMetadata()
public void setMaxBytesMetadata(long maxBytesMetadata)
public long getMaxTotalBytesRead()
protected boolean shouldCheckCrc(int len,
String id)
shouldCheckCrc in class ChunkSeqReaderpublic boolean isCheckCrc()
public void setCheckCrc(boolean checkCrc)
public boolean isCallbackMode()
public void setChunkLoadBehaviour(ChunkLoadBehaviour chunkLoadBehaviour)
public void setIncludeNonBufferedChunks(boolean includeNonBufferedChunks)
includeNonBufferedChunks - Copyright © 2013. All rights reserved.