public class ReadAheadBufferedStream
extends java.io.FilterInputStream
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
buf |
private static int |
BUF_SIZE |
private int |
end |
private int |
pos |
| Constructor and Description |
|---|
ReadAheadBufferedStream(java.io.InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
private void |
fillBuffer(int minNeededBytes)
Fill buffer with required length, or available bytes.
|
boolean |
markSupported() |
int |
read()
Reading one byte from cache of socket if needed.
|
int |
read(byte[] externalBuf,
int off,
int len)
Returing byte array, from cache of reading socket if needed.
|
void |
reset() |
long |
skip(long n) |
private static final int BUF_SIZE
private volatile byte[] buf
private int end
private int pos
public int read()
throws java.io.IOException
read in class java.io.FilterInputStreamjava.io.IOException - if socket reading error.public int read(byte[] externalBuf,
int off,
int len)
throws java.io.IOException
read in class java.io.FilterInputStreamexternalBuf - buffer to filloff - offsetlen - length to readjava.io.IOException - if exception during socket readingprivate void fillBuffer(int minNeededBytes)
throws java.io.IOException
minNeededBytes - asked number of bytesjava.io.IOException - in case of failing reading stream.public long skip(long n)
throws java.io.IOException
skip in class java.io.FilterInputStreamjava.io.IOExceptionpublic int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOExceptionpublic void reset()
throws java.io.IOException
reset in class java.io.FilterInputStreamjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.FilterInputStreampublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOException