Package com.clickhouse.client.data
Class ClickHouseStreamResponse
- java.lang.Object
-
- com.clickhouse.client.data.ClickHouseStreamResponse
-
- All Implemented Interfaces:
ClickHouseResponse
,Serializable
,AutoCloseable
public class ClickHouseStreamResponse extends Object implements ClickHouseResponse
A stream response from server.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<ClickHouseColumn>
columns
protected ClickHouseConfig
config
protected static List<ClickHouseColumn>
defaultTypes
protected InputStream
input
protected ClickHouseDataProcessor
processor
protected ClickHouseResponseSummary
summary
-
Fields inherited from interface com.clickhouse.client.ClickHouseResponse
EMPTY
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ClickHouseStreamResponse(ClickHouseConfig config, ClickHouseInputStream input, Map<String,Object> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.clickhouse.client.ClickHouseResponse
firstRecord, pipe, stream
-
-
-
-
Field Detail
-
defaultTypes
protected static final List<ClickHouseColumn> defaultTypes
-
config
protected final ClickHouseConfig config
-
input
protected final transient InputStream input
-
processor
protected final transient ClickHouseDataProcessor processor
-
columns
protected final List<ClickHouseColumn> columns
-
summary
protected final ClickHouseResponseSummary summary
-
-
Constructor Detail
-
ClickHouseStreamResponse
protected ClickHouseStreamResponse(ClickHouseConfig config, ClickHouseInputStream input, Map<String,Object> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary) throws IOException
- Throws:
IOException
-
-
Method Detail
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input) throws IOException
- Throws:
IOException
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input, Map<String,Object> 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,Object> settings, List<ClickHouseColumn> columns) throws IOException
- Throws:
IOException
-
of
public static ClickHouseResponse of(ClickHouseConfig config, ClickHouseInputStream input, Map<String,Object> settings, List<ClickHouseColumn> columns, ClickHouseResponseSummary summary) throws IOException
- Throws:
IOException
-
isClosed
public boolean isClosed()
Description copied from interface:ClickHouseResponse
Checks whether the reponse has been closed or not.- Specified by:
isClosed
in interfaceClickHouseResponse
- Returns:
- true if the response has been closed; false otherwise
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceClickHouseResponse
-
getColumns
public List<ClickHouseColumn> getColumns()
Description copied from interface:ClickHouseResponse
Gets list of columns.- Specified by:
getColumns
in interfaceClickHouseResponse
- Returns:
- non-null list of column
-
getFormat
public ClickHouseFormat getFormat()
-
getSummary
public ClickHouseResponseSummary getSummary()
Description copied from interface:ClickHouseResponse
Gets summary of this response. Keep in mind that the summary may change over time until response is closed.- Specified by:
getSummary
in interfaceClickHouseResponse
- Returns:
- non-null summary of this response
-
getInputStream
public InputStream getInputStream()
Description copied from interface:ClickHouseResponse
Gets 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:
getInputStream
in interfaceClickHouseResponse
- Returns:
- input stream for getting raw data returned from server
-
records
public Iterable<ClickHouseRecord> records()
Description copied from interface:ClickHouseResponse
Returns an iterable collection of records which can be walked through in a foreach loop. Please pay attention that: 1)UncheckedIOException
might be thrown when iterating through the collection; and 2) it's not supposed to be called for more than once.- Specified by:
records
in interfaceClickHouseResponse
- Returns:
- non-null iterable collection
-
-