static class SaxReaderImpl.MemptrInputStream
extends java.io.InputStream
| Modifier and Type | Field and Description |
|---|---|
private boolean |
isStarted
Lazy initialization flag.
|
private memptr |
mptr
A valid memptr
|
private java.util.concurrent.atomic.AtomicLong |
position
Current read cursor position, started from index 1.
|
private long |
totalSize
total size of memptr.
|
| Constructor and Description |
|---|
MemptrInputStream(memptr source)
Constructor accepting a memptr, which will read after first call.
|
| Modifier and Type | Method and Description |
|---|---|
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] array,
int off,
int len)
Read a chunk of bytes from the current read position in the stream to the
offset calculated by given length or to the
EOF, whichever
comes first. |
void |
reset()
Resets the input stream to begin reading from the first character
of this input stream's underlying buffer.
|
private volatile boolean isStarted
private final memptr mptr
private final java.util.concurrent.atomic.AtomicLong position
private long totalSize
MemptrInputStream(memptr source)
source - A valid memptr object.public int read()
throws java.io.IOException
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.read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] array,
int off,
int len)
throws java.io.IOException
EOF, whichever
comes first. The EOF character is not returned.read in class java.io.InputStreamarray - The array in which to save bytes.off - The offset into the array at which to start saving bytes.len - The maximum number of bytes to read.EOF has been
reached). The number of bytes read will be the smaller
of the len parameter or the actual bytes left
before the EOF.java.io.IOException - If an I/O error occurs.public void reset()
throws java.io.IOException
reset in class java.io.InputStreamjava.io.IOException