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

pack-priv Class PngIDatChunkInputStream

extends InputStream
Class Inheritance
Imports
java.io.IOException, .InputStream, java.util.ArrayList, .Arrays, .List, java.util.zip.CRC32, jogamp.opengl.util.pngj.chunks.ChunkHelper

Reads a sequence of contiguous IDAT chunks

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private boolean
private final CRC32
private boolean
pack-priv List<PngIDatChunkInputStream.IdatChunkInfo>
private final byte[]
private final InputStream
private int
private long
private int

Constructor Summary

AccessConstructor and Description
pack-priv
PngIDatChunkInputStream(final InputStream iStream, final int lenFirstChunk, final long offset)

Constructor must be called just after reading length and id of first IDAT chunk

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

does NOT close the associated stream!
pack-priv void
disableCrcCheck()

Disables CRC checking.

private void
pack-priv void
forceChunkEnd()

sometimes last row read does not fully consumes the chunk here we read the reamaing dummy bytes

pack-priv byte[]
pack-priv int
pack-priv long
pack-priv boolean
public int
read(final byte[]
the buffer into which the data is read.
b
,
final int
the start offset in array b at which the data is written.
off
,
final int
the maximum number of bytes to read.
len
)

Overrides java.io.InputStream.read.

This can return less than len, but never 0 Returns -1 if "pseudo file" ended prematurely.
public int
read(final byte[]
the buffer into which the data is read.
b
)

Overrides java.io.InputStream.read.

Reads some number of bytes from the input stream and stores them into the buffer array b.
public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.
Inherited from java.io.InputStream:
availablemarkmarkSupportednullInputStreamreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

checkCrcback to summary
private boolean checkCrc
crcEngineback to summary
private final CRC32 crcEngine
endedback to summary
private boolean ended
foundChunksInfoback to summary
pack-priv List<PngIDatChunkInputStream.IdatChunkInfo> foundChunksInfo
idLastChunkback to summary
private final byte[] idLastChunk
inputStreamback to summary
private final InputStream inputStream
lenLastChunkback to summary
private int lenLastChunk
offsetback to summary
private long offset
toReadThisChunkback to summary
private int toReadThisChunk

Constructor Detail

PngIDatChunkInputStreamback to summary
pack-priv PngIDatChunkInputStream(final InputStream iStream, final int lenFirstChunk, final long offset)

Constructor must be called just after reading length and id of first IDAT chunk

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

does NOT close the associated stream!

Annotations
@Override
Exceptions
IOException:

Doc from java.io.InputStream.close.

if an I/O error occurs.

disableCrcCheckback to summary
pack-priv void disableCrcCheck()

Disables CRC checking. This can make reading faster

endChunkGoForNextback to summary
private void endChunkGoForNext()
forceChunkEndback to summary
pack-priv void forceChunkEnd()

sometimes last row read does not fully consumes the chunk here we read the reamaing dummy bytes

getIdLastChunkback to summary
pack-priv byte[] getIdLastChunk()
getLenLastChunkback to summary
pack-priv int getLenLastChunk()
getOffsetback to summary
pack-priv long getOffset()
isEndedback to summary
pack-priv boolean isEnded()
readback to summary
public int read(final byte[] b, final int off, final int len) throws IOException

Overrides java.io.InputStream.read.

This can return less than len, but never 0 Returns -1 if "pseudo file" ended prematurely. That is our error.

Parameters
b:byte[]

Doc from java.io.InputStream.read.

the buffer into which the data is read.

off:int

Doc from java.io.InputStream.read.

the start offset in array b at which the data is written.

len:int

Doc from java.io.InputStream.read.

the maximum number of bytes to read.

Returns:int

Doc from java.io.InputStream.read.

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.InputStream.read.

If the first byte cannot be read for any reason other than end of file, or if the input stream has been closed, or if some other I/O error occurs.

readback to summary
public int read(final byte[] b) throws IOException

Overrides java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads some number of bytes from the input stream and stores them into the buffer array b. The number of bytes actually read is returned as an integer. This method blocks until input data is available, end of file is detected, or an exception is thrown.

If the length of b is zero, then no bytes are read and 0 is returned; otherwise, there is an attempt to read at least one byte. If no byte is available because the stream is at the end of the file, the value -1 is returned; otherwise, at least one byte is read and stored into b.

The first byte read is stored into element b[0], the next one into b[1], and so on. The number of bytes read is, at most, equal to the length of b. Let k be the number of bytes actually read; these bytes will be stored in elements b[0] through b[k-1], leaving elements b[k] through b[b.length-1] unaffected.

Parameters
b:byte[]

the buffer into which the data is read.

Returns:int

the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached.

Annotations
@Override
Exceptions
IOException:
If the first byte cannot be read for any reason other than the end of the file, if the input stream has been closed, or if some other I/O error occurs.
readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
jogamp.opengl.util.pngj back to summary

pack-priv Class PngIDatChunkInputStream.IdatChunkInfo

extends Object
Class Inheritance
  • java.lang.Object
  • jogamp.opengl.util.pngj.PngIDatChunkInputStream.IdatChunkInfo

Field Summary

Modifier and TypeField and Description
public final int
public final long

Constructor Summary

AccessConstructor and Description
private
IdatChunkInfo(final int len, final long offset)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lenback to summary
public final int len
offsetback to summary
public final long offset

Constructor Detail

IdatChunkInfoback to summary
private IdatChunkInfo(final int len, final long offset)