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.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionpublic void rewind()
rewind in interface Rewindablepublic boolean canRewind()
canRewind in interface Rewindablepublic void willNotRewind()
willNotRewind in interface Rewindablepublic int read()
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.InputStreamjava.io.IOException