Package com.clickhouse.client
Class ClickHouseStreamResponse
java.lang.Object
com.clickhouse.client.ClickHouseStreamResponse
- All Implemented Interfaces:
ClickHouseResponse,Serializable,AutoCloseable
A stream response from server.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClickHouseConfigprotected static final List<ClickHouseColumn>protected final ClickHouseDataProcessorprotected final ClickHouseResponseSummaryFields inherited from interface com.clickhouse.client.ClickHouseResponse
EMPTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHouseStreamResponse(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Gets list of columns.Gets input stream of the response.Gets summary of this response.booleanisClosed()Checks whether the response has been closed or not.static ClickHouseResponseof(ClickHouseConfig config, ClickHouseInputStream input) static ClickHouseResponseof(ClickHouseConfig config, ClickHouseInputStream input, List<ClickHouseColumn> columns) static ClickHouseResponseof(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings) static ClickHouseResponseof(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings, List<ClickHouseColumn> columns) static ClickHouseResponseof(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary) records()Returns an iterable collection of records which can be walked through in a foreach loop.<T> Iterable<T>Returns an iterable collection of mapped objects which can be walked through in a foreach loop.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.clickhouse.client.ClickHouseResponse
firstRecord, firstRecord, pipe, stream, stream
-
Field Details
-
defaultTypes
-
config
-
processor
-
summary
-
-
Constructor Details
-
ClickHouseStreamResponse
protected ClickHouseStreamResponse(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary) throws IOException- Throws:
IOException
-
-
Method Details
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input) throws IOException - Throws:
IOException
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings) throws IOException- Throws:
IOException
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input, List<ClickHouseColumn> columns) throws IOException - Throws:
IOException
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings, List<ClickHouseColumn> columns) throws IOException- Throws:
IOException
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input, Map<String, Serializable> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary) throws IOException- Throws:
IOException
-
isClosed
public boolean isClosed()Description copied from interface:ClickHouseResponseChecks whether the response has been closed or not.- Specified by:
isClosedin interfaceClickHouseResponse- Returns:
- true if the response has been closed; false otherwise
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceClickHouseResponse
-
getColumns
Description copied from interface:ClickHouseResponseGets list of columns.- Specified by:
getColumnsin interfaceClickHouseResponse- Returns:
- non-null list of column
-
getFormat
-
getSummary
Description copied from interface:ClickHouseResponseGets summary of this response. Keep in mind that the summary may change over time until response is closed.- Specified by:
getSummaryin interfaceClickHouseResponse- Returns:
- non-null summary of this response
-
getInputStream
Description copied from interface:ClickHouseResponseGets input stream of the response. In general, this is the most memory-efficient way for streaming data from server to client. However, this also means additional work is required for deserialization, especially when using a binary format.- Specified by:
getInputStreamin interfaceClickHouseResponse- Returns:
- non-null input stream for getting raw data returned from server
-
records
Description copied from interface:ClickHouseResponseReturns an iterable collection of records which can be walked through in a foreach loop. Please pay attention that: 1)UncheckedIOExceptionmight be thrown when iterating through the collection; and 2) it's not supposed to be called for more than once.- Specified by:
recordsin interfaceClickHouseResponse- Returns:
- non-null iterable collection
-
records
Description copied from interface:ClickHouseResponseReturns an iterable collection of mapped objects which can be walked through in a foreach loop. WhenobjClassis null orClickHouseRecord, it's same as callingClickHouseResponse.records().- Specified by:
recordsin interfaceClickHouseResponse- Type Parameters:
T- type of the mapped object- Parameters:
objClass- non-null class of the mapped object- Returns:
- non-null iterable collection
-