Class ReadAheadBufferedStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.mariadb.jdbc.internal.io.input.ReadAheadBufferedStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ReadAheadBufferedStream extends FilterInputStream
Permit to buffer socket data, reading not only asked bytes, but available number of bytes when possible.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description ReadAheadBufferedStream(InputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()booleanmarkSupported()intread()Reading one byte from cache of socket if needed.intread(byte[] externalBuf, int off, int len)Returing byte array, from cache of reading socket if needed.voidreset()longskip(long n)-
Methods inherited from class java.io.FilterInputStream
mark, read
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
ReadAheadBufferedStream
public ReadAheadBufferedStream(InputStream in)
-
-
Method Detail
-
read
public int read() throws IOExceptionReading one byte from cache of socket if needed.- Overrides:
readin classFilterInputStream- Returns:
- byte value
- Throws:
IOException- if socket reading error.
-
read
public int read(byte[] externalBuf, int off, int len) throws IOExceptionReturing byte array, from cache of reading socket if needed.- Overrides:
readin classFilterInputStream- Parameters:
externalBuf- buffer to filloff- offsetlen- length to read- Returns:
- number of added bytes
- Throws:
IOException- if exception during socket reading
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classFilterInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classFilterInputStream
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-
-