Package com.clickhouse.client.data
Class ClickHousePipedStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.clickhouse.client.data.ClickHousePipedStream
-
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
public class ClickHousePipedStream extends OutputStream
A combination ofPipedOutputStream
andPipedInputStream
for streaming data between server and client. To avoid dead lock and high memory usage, please make sure writer and reader are on two separate threads.
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockingQueue<ByteBuffer>
queue
-
Constructor Summary
Constructors Constructor Description ClickHousePipedStream(int bufferSize, int queueLength, int timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
ClickHouseInputStream
getInput()
void
write(byte[] b, int off, int len)
void
write(int b)
-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Field Detail
-
queue
protected final BlockingQueue<ByteBuffer> queue
-
-
Method Detail
-
getInput
public ClickHouseInputStream getInput()
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-
flush
public void flush() throws IOException
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
write
public void write(int b) throws IOException
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
-