Package com.clickhouse.client.data
Class ClickHouseLZ4InputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.clickhouse.client.ClickHouseInputStream
-
- com.clickhouse.client.data.ClickHouseLZ4InputStream
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class ClickHouseLZ4InputStream extends ClickHouseInputStream
Reader from clickhouse in lz4.
-
-
Field Summary
-
Fields inherited from class com.clickhouse.client.ClickHouseInputStream
afterClose, byteBuffer, closed, EMPTY_BUFFER, EMPTY_BYTES
-
-
Constructor Summary
Constructors Constructor Description ClickHouseLZ4InputStream(InputStream stream)
ClickHouseLZ4InputStream(InputStream stream, Runnable afterClose)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
int
peek()
Peeks one byte.long
pipe(ClickHouseOutputStream output)
Reads all bytes and write into given output stream.int
read()
int
read(byte[] b, int off, int len)
ClickHouseByteBuffer
read(int len)
byte
readByte()
Reads one single byte from the input stream.-
Methods inherited from class com.clickhouse.client.ClickHouseInputStream
closeQuietly, isClosed, of, of, of, of, of, readAsciiString, readAsciiString, readBytes, readString, readString, readUnicodeString, readUnicodeString, readUnsignedByte, readVarInt
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
-
-
-
-
Constructor Detail
-
ClickHouseLZ4InputStream
public ClickHouseLZ4InputStream(InputStream stream)
-
ClickHouseLZ4InputStream
public ClickHouseLZ4InputStream(InputStream stream, Runnable afterClose)
-
-
Method Detail
-
peek
public int peek() throws IOException
Description copied from class:ClickHouseInputStream
Peeks one byte. It's similar asInputStream.read()
except it never changes cursor.- Specified by:
peek
in classClickHouseInputStream
- Returns:
- the next byte of data, or -1 if the end of the stream is reached
- Throws:
IOException
- when failed to read value from input stream or reached end of the stream
-
pipe
public long pipe(ClickHouseOutputStream output) throws IOException
Description copied from class:ClickHouseInputStream
Reads all bytes and write into given output stream.- Specified by:
pipe
in classClickHouseInputStream
- Parameters:
output
- non-null output stream- Returns:
- bytes being written into output stream
- Throws:
IOException
- when failed to read value from input stream or reached end of the stream
-
readByte
public byte readByte() throws IOException
Description copied from class:ClickHouseInputStream
Reads one single byte from the input stream. UnlikeInputStream.read()
, it will throwIOException
if the input stream has been closed. In general, this method should be faster thanInputStream.read()
, especially when it's an input stream backed by byte[] orByteBuffer
.- Specified by:
readByte
in classClickHouseInputStream
- Returns:
- byte value if present
- Throws:
IOException
- when failed to read value from input stream or reached end of the stream
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public ClickHouseByteBuffer read(int len) throws IOException
- Overrides:
read
in classClickHouseInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classClickHouseInputStream
- Throws:
IOException
-
-