Package com.clickhouse.client.stream
Class IterableMultipleInputStream<T>
- java.lang.Object
-
- java.io.InputStream
-
- com.clickhouse.client.ClickHouseInputStream
-
- com.clickhouse.client.stream.AbstractByteArrayInputStream
-
- com.clickhouse.client.stream.IterableMultipleInputStream<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public final class IterableMultipleInputStream<T> extends AbstractByteArrayInputStream
-
-
Field Summary
-
Fields inherited from class com.clickhouse.client.stream.AbstractByteArrayInputStream
buffer, limit, position
-
Fields inherited from class com.clickhouse.client.ClickHouseInputStream
byteBuffer, closed, copyTo, EMPTY_BUFFER, EMPTY_BYTES, ERROR_INCOMPLETE_READ, ERROR_NULL_BYTES, ERROR_REUSE_BUFFER, ERROR_STREAM_CLOSED, file, postCloseAction
-
-
Constructor Summary
Constructors Constructor Description IterableMultipleInputStream(Iterable<T> source, Function<T,InputStream> converter, Runnable postCloseAction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()longpipe(ClickHouseOutputStream output)Reads all remaining bytes and write into given output stream.ClickHouseByteBufferreadCustom(ClickHouseDataUpdater reader)Reads bytes using custom reader.longskip(long n)protected intupdateBuffer()Update inner byte array along withpositionandlimitas needed.-
Methods inherited from class com.clickhouse.client.stream.AbstractByteArrayInputStream
available, ensureOpen, peek, read, read, readBuffer, readByte, readBytes
-
Methods inherited from class com.clickhouse.client.ClickHouseInputStream
closeQuietly, empty, getUnderlyingFile, isClosed, of, of, of, of, of, of, of, of, of, of, of, of, of, of, of, of, pipe, pipe, readAsciiString, readAsciiString, readString, readString, readUnicodeString, readUnicodeString, readUnsignedByte, readVarInt, readVarLong, save, save, setCopyToTarget, wrap
-
Methods inherited from class java.io.InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, transferTo
-
-
-
-
Method Detail
-
updateBuffer
protected int updateBuffer() throws IOExceptionDescription copied from class:AbstractByteArrayInputStreamUpdate inner byte array along withpositionandlimitas needed.- Specified by:
updateBufferin classAbstractByteArrayInputStream- Returns:
- remaining bytes in buffer
- Throws:
IOException- when failed to read value
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractByteArrayInputStream- Throws:
IOException
-
readCustom
public ClickHouseByteBuffer readCustom(ClickHouseDataUpdater reader) throws IOException
Description copied from class:ClickHouseInputStreamReads bytes using custom reader. Stream will be closed automatically when it reached end of stream. However, unlikeClickHouseInputStream.readBuffer(int), this method will never throwEOFException.- Overrides:
readCustomin classAbstractByteArrayInputStream- Parameters:
reader- non-null data reader- Returns:
- non-null byte buffer
- Throws:
IOException- when failed to read bytes from input stream, not able to retrieve all bytes, or reached end of the stream
-
pipe
public long pipe(ClickHouseOutputStream output) throws IOException
Description copied from class:ClickHouseInputStreamReads all remaining bytes and write into given output stream. Current input stream will be closed automatically at the end of writing, butoutputwill remain open.- Overrides:
pipein classAbstractByteArrayInputStream- Parameters:
output- non-null output stream- Returns:
- bytes being written into output stream
- Throws:
IOException- when failed to read value from input stream or reached end of the stream
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classAbstractByteArrayInputStream- Throws:
IOException
-
-