Package com.clickhouse.client
Class ClickHouseDataStreamFactory
- java.lang.Object
-
- com.clickhouse.client.ClickHouseDataStreamFactory
-
public class ClickHouseDataStreamFactory extends Object
Factory class for creating objects to handle data stream.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringERROR_NO_DESERIALIZERprotected static StringERROR_NO_SERIALIZERprotected static StringERROR_UNSUPPORTED_FORMAT
-
Constructor Summary
Constructors Constructor Description ClickHouseDataStreamFactory()
-
Method Summary
-
-
-
Field Detail
-
ERROR_NO_DESERIALIZER
protected static final String ERROR_NO_DESERIALIZER
- See Also:
- Constant Field Values
-
ERROR_NO_SERIALIZER
protected static final String ERROR_NO_SERIALIZER
- See Also:
- Constant Field Values
-
ERROR_UNSUPPORTED_FORMAT
protected static final String ERROR_UNSUPPORTED_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static ClickHouseDataStreamFactory getInstance()
Gets instance of the factory class.- Returns:
- instance of the factory class
-
getProcessor
public ClickHouseDataProcessor getProcessor(ClickHouseConfig config, ClickHouseInputStream input, ClickHouseOutputStream output, Map<String,Object> settings, List<ClickHouseColumn> columns) throws IOException
Gets data processor according to givenClickHouseConfigand settings.- Parameters:
config- non-null configuration containing information likeClickHouseFormatinput- input stream for deserialization, must not be null whenoutputis nulloutput- output stream for serialization, must not be null wheninputis nullsettings- nullable settingscolumns- nullable list of columns- Returns:
- data processor, which might be null
- Throws:
IOException- when failed to read columns from input stream
-
getDeserializer
public ClickHouseDeserializer<ClickHouseValue> getDeserializer(ClickHouseFormat format)
Gets deserializer for the given data format.- Parameters:
format- data format, null meansClickHouseDefaults.FORMAT.getEffectiveDefaultValue()- Returns:
- deserializer for the given data format
-
getSerializer
public ClickHouseSerializer<ClickHouseValue> getSerializer(ClickHouseFormat format)
Gets serializer for the given data format.- Parameters:
format- data format, null meansClickHouseDefaults.FORMAT.getEffectiveDefaultValue()- Returns:
- serializer for the given data format
-
createPipedStream
@Deprecated public ClickHousePipedStream createPipedStream(ClickHouseConfig config)
Deprecated.will be removed in v0.3.3, please usecreatePipedOutputStream(ClickHouseConfig, Runnable)insteadCreates a piped stream.- Parameters:
config- non-null configuration- Returns:
- piped stream
-
createPipedOutputStream
public ClickHousePipedOutputStream createPipedOutputStream(ClickHouseConfig config, Runnable postCloseAction)
Creates a piped output stream.- Parameters:
config- non-null configurationpostCloseAction- custom action will be performed right after closing the output stream- Returns:
- piped output stream
-
createPipedOutputStream
public ClickHousePipedOutputStream createPipedOutputStream(int bufferSize, int queueSize, int timeout, Runnable postCloseAction)
-
-