Class ReadAheadBufferedStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.mariadb.jdbc.client.socket.impl.ReadAheadBufferedStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ReadAheadBufferedStream extends FilterInputStream
Permit to buf 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)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
boolean
markSupported()
int
read()
int
read(byte[] externalBuf, int off, int len)
Returing byte array, from cache of reading socket if needed.void
reset()
long
skip(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)
Constructor- Parameters:
in
- socket input stream
-
-
Method Detail
-
read
public int read(byte[] externalBuf, int off, int len) throws IOException
Returing byte array, from cache of reading socket if needed.- Overrides:
read
in classFilterInputStream
- Parameters:
externalBuf
- buf to filloff
- offsetlen
- length to read- Returns:
- number of added bytes
- Throws:
IOException
- if exception during socket reading
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classFilterInputStream
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-
available
public int available() throws IOException
- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
read
public int read() throws IOException
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classFilterInputStream
- Throws:
IOException
-
-