Class ClickHousePassThruStream

java.lang.Object
com.clickhouse.data.ClickHousePassThruStream
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ClickHouseFile

public class ClickHousePassThruStream extends Object implements Serializable
This class encapsulates custom input and output stream to ensure no compression/decompression will be applied during execution.
See Also:
  • Field Details

  • Constructor Details

  • 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

      public ClickHouseInputStream getInputStream()
      Gets the input stream for reading.
      Returns:
      non-null input stream
    • newInputStream

      public ClickHouseInputStream newInputStream(int bufferSize, Runnable postCloseAction)
      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

      public ClickHouseOutputStream getOutputStream()
      Gets the output stream for writing.
      Returns:
      non-null output stream
    • newOutputStream

      public ClickHouseOutputStream newOutputStream(int bufferSize, Runnable postCloseAction)
      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

      public ClickHouseCompression getCompressionAlgorithm()
      Gets compression algorithm, which could be null. Use hasCompression() to check first.
      Returns:
      compression algorithm, could be null
    • getCompressionLevel

      public int getCompressionLevel()
      Gets compression level.
      Returns:
      compression level
    • getFormat

      public ClickHouseFormat getFormat()
      Gets data format, which could be null. Use hasFormat() 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