Package com.clickhouse.data
Class ClickHousePassThruStream
java.lang.Object
com.clickhouse.data.ClickHousePassThruStream
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ClickHouseFile
This class encapsulates custom input and output stream to ensure no
compression/decompression will be applied during execution.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final ClickHousePassThruStreamNull stream which has no compression and format.static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHousePassThruStream(InputStream in, OutputStream out, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
Method Summary
Modifier and TypeMethodDescriptionGets compression algorithm, which could be null.intGets compression level.Gets data format, which could be null.Gets the input stream for reading.Gets the output stream for writing.booleanChecks if the compression algorithm is defined or not.booleanChecks if the data format is defined or not.booleanhasInput()Checks if input stream is available or not.booleanChecks if output stream is available or not.booleanChecks if the data is compressed or not.newInputStream(int bufferSize, Runnable postCloseAction) Creates a wrapped input stream for reading.newOutputStream(int bufferSize, Runnable postCloseAction) Creates a wrapped output stream for writing.static ClickHousePassThruStreamof(InputStream in, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) static ClickHousePassThruStreamof(InputStream in, OutputStream out, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) static ClickHousePassThruStreamof(OutputStream out, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format)
-
Field Details
-
TYPE_NAME
- See Also:
-
ERROR_NO_INPUT
- See Also:
-
ERROR_NO_OUTPUT
- See Also:
-
NULL
Null stream which has no compression and format.
-
-
Constructor Details
-
ClickHousePassThruStream
protected ClickHousePassThruStream(InputStream in, OutputStream out, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format)
-
-
Method Details
-
of
public static ClickHousePassThruStream of(InputStream in, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
of
public static ClickHousePassThruStream of(OutputStream out, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
of
public static ClickHousePassThruStream of(InputStream in, OutputStream out, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
getInputStream
Gets the input stream for reading.- Returns:
- non-null input stream
-
newInputStream
Creates a wrapped input stream for reading. This method is supposed to be called once and only once.- Parameters:
bufferSize- buffer size which is always greater than zero(usually 4096 or larger)postCloseAction- custom action will be performed right after closing the input stream- Returns:
- non-null wrapped input stream
-
getOutputStream
Gets the output stream for writing.- Returns:
- non-null output stream
-
newOutputStream
Creates a wrapped output stream for writing. This method is supposed to be called once and only once.- Parameters:
bufferSize- buffer size which is always greater than zero(usually 4096 or larger)postCloseAction- custom action will be performed right after closing the output stream- Returns:
- non-null wrapped output stream
-
getCompressionAlgorithm
Gets compression algorithm, which could be null. UsehasCompression()to check first.- Returns:
- compression algorithm, could be null
-
getCompressionLevel
public int getCompressionLevel()Gets compression level.- Returns:
- compression level
-
getFormat
Gets data format, which could be null. UsehasFormat()to check first.- Returns:
- data format, could be null
-
hasCompression
public boolean hasCompression()Checks if the compression algorithm is defined or not.- Returns:
- true if the compression algorithm is defined; false otherwise
-
hasFormat
public boolean hasFormat()Checks if the data format is defined or not.- Returns:
- true if the data format is defined; false otherwise
-
hasInput
public boolean hasInput()Checks if input stream is available or not.- Returns:
- true if input stream is available; false otherwise
-
hasOutput
public boolean hasOutput()Checks if output stream is available or not.- Returns:
- true if output stream is available; false otherwise
-
isCompressed
public boolean isCompressed()Checks if the data is compressed or not.- Returns:
- true if the data is compressed; false otherwise
-