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
EMPTY_BUFFER, EMPTY_BYTES
-
-
Constructor Summary
Constructors Constructor Description ClickHouseLZ4InputStream(InputStream stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
boolean
isClosed()
Checks if the input stream has been closed or not.int
read()
int
read(byte[] b, int off, int len)
byte
readByte()
Reads one single byte from the input stream.String
readString(int byteLength, Charset charset)
Reads string from the input stream.-
Methods inherited from class com.clickhouse.client.ClickHouseInputStream
of, of, of, readAsciiString, readAsciiString, readBytes, 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)
-
-
Method Detail
-
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
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
isClosed
public boolean isClosed()
Description copied from class:ClickHouseInputStream
Checks if the input stream has been closed or not.- Specified by:
isClosed
in classClickHouseInputStream
- Returns:
- true if the input stream has been closed; false otherwise
-
readString
public String readString(int byteLength, Charset charset) throws IOException
Description copied from class:ClickHouseInputStream
Reads string from the input stream. WhenbyteLength
is zero or negative number, this method will always return empty string.- Overrides:
readString
in classClickHouseInputStream
- Parameters:
byteLength
- length in bytecharset
- charset, null is treated asStandardCharsets.UTF_8
- Returns:
- non-null string
- Throws:
IOException
- when failed to read value from input stream, not able to retrieve all bytes, or reached end of the stream
-
-