public final class MergedStream
extends java.io.InputStream
InputStream
implementation that is used to "unwind" some
data previously read from an input stream; so that as long as some of
that data remains, it's returned; but as long as it's read, we'll
just use data from the underlying original stream.
This is similar to PushbackInputStream
, but here there's
only one implicit pushback, when instance is constructed.Modifier and Type | Field and Description |
---|---|
(package private) ReaderConfig |
mConfig |
(package private) byte[] |
mData |
(package private) int |
mEnd |
(package private) java.io.InputStream |
mIn |
(package private) int |
mPtr |
Constructor and Description |
---|
MergedStream(ReaderConfig cfg,
java.io.InputStream in,
byte[] buf,
int start,
int end) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
void |
close() |
private void |
freeBuffers() |
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
final ReaderConfig mConfig
final java.io.InputStream mIn
byte[] mData
int mPtr
final int mEnd
public MergedStream(ReaderConfig cfg, java.io.InputStream in, byte[] buf, int start, int end)
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void mark(int readlimit)
mark
in class java.io.InputStream
public boolean markSupported()
markSupported
in class java.io.InputStream
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
private void freeBuffers()