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 intavailable()voidclose()booleanisClosed()Checks if the input stream has been closed or not.intread()intread(byte[] b, int off, int len)bytereadByte()Reads one single byte from the input stream.StringreadString(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 IOExceptionDescription copied from class:ClickHouseInputStreamReads one single byte from the input stream. UnlikeInputStream.read(), it will throwIOExceptionif 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:
readBytein 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:
availablein classInputStream- Throws:
IOException
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
isClosed
public boolean isClosed()
Description copied from class:ClickHouseInputStreamChecks if the input stream has been closed or not.- Specified by:
isClosedin 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:ClickHouseInputStreamReads string from the input stream. WhenbyteLengthis zero or negative number, this method will always return empty string.- Overrides:
readStringin 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
-
-