public class RewindableInputStream extends java.io.InputStream implements Rewindable
Modifier and Type | Class and Description |
---|---|
(package private) static class |
RewindableInputStream.Block |
Modifier and Type | Field and Description |
---|---|
private RewindableInputStream.Block |
curBlock |
private int |
curBlockAvail
If curBlockAvail > 0, then there are curBlockAvail bytes available to be
returned starting at curBlockPos in curBlock.buf.
|
private int |
curBlockPos |
private boolean |
eof
true if we have got an EOF from the underlying InputStream
|
private RewindableInputStream.Block |
head |
private java.io.InputStream |
in |
private RewindableInputStream.Block |
lastBlock |
private boolean |
pretendClosed |
private boolean |
saving
true unless willNotRewind has been called
|
Constructor and Description |
---|
RewindableInputStream(java.io.InputStream in) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
boolean |
canRewind() |
void |
close() |
int |
read() |
int |
read(byte[] b,
int off,
int len) |
void |
rewind() |
void |
willNotRewind() |
private RewindableInputStream.Block head
private int curBlockAvail
private RewindableInputStream.Block curBlock
private int curBlockPos
private RewindableInputStream.Block lastBlock
private boolean saving
private final java.io.InputStream in
private boolean pretendClosed
private boolean eof
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 rewind()
rewind
in interface Rewindable
public boolean canRewind()
canRewind
in interface Rewindable
public void willNotRewind()
willNotRewind
in interface Rewindable
public int read() 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 int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException