Package com.clickhouse.client.stream
Class AbstractByteArrayOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.clickhouse.client.ClickHouseOutputStream
-
- com.clickhouse.client.stream.AbstractByteArrayOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Direct Known Subclasses:
Lz4OutputStream,WrappedOutputStream
public abstract class AbstractByteArrayOutputStream extends ClickHouseOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufferprotected intposition-
Fields inherited from class com.clickhouse.client.ClickHouseOutputStream
closed, ERROR_INCOMPLETE_READ, ERROR_NULL_BYTES, ERROR_REUSE_BUFFER, ERROR_STREAM_CLOSED, file, postCloseAction
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractByteArrayOutputStream(ClickHouseFile file, int bufferSize, Runnable postCloseAction)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidflushBuffer()protected abstract voidflushBuffer(byte[] bytes, int offset, int length)ClickHouseOutputStreamtransferBytes(byte[] bytes, int offset, int length)Transfers the given bytes into output stream, without creating a copy as inClickHouseOutputStream.writeBytes(byte[], int, int).ClickHouseOutputStreamwriteByte(byte b)Writes a single byte into output stream.ClickHouseOutputStreamwriteBytes(byte[] bytes, int offset, int length)Writes copy of given bytes into output stream.ClickHouseOutputStreamwriteCustom(ClickHouseDataUpdater writer)Writes bytes using custom writer.-
Methods inherited from class com.clickhouse.client.ClickHouseOutputStream
close, empty, ensureOpen, getUnderlyingFile, isClosed, of, of, of, of, transferBytes, transferBytes, write, write, write, writeAsciiString, writeBuffer, writeBytes, writeBytes, writeString, writeUnicodeString, writeUnsignedVarInt, writeVarInt
-
Methods inherited from class java.io.OutputStream
flush, nullOutputStream
-
-
-
-
Constructor Detail
-
AbstractByteArrayOutputStream
protected AbstractByteArrayOutputStream(ClickHouseFile file, int bufferSize, Runnable postCloseAction)
-
-
Method Detail
-
flushBuffer
protected void flushBuffer() throws IOException- Throws:
IOException
-
flushBuffer
protected abstract void flushBuffer(byte[] bytes, int offset, int length) throws IOException- Throws:
IOException
-
transferBytes
public ClickHouseOutputStream transferBytes(byte[] bytes, int offset, int length) throws IOException
Description copied from class:ClickHouseOutputStreamTransfers the given bytes into output stream, without creating a copy as inClickHouseOutputStream.writeBytes(byte[], int, int).- Specified by:
transferBytesin classClickHouseOutputStream- Parameters:
bytes- non-null byte arrayoffset- offset of the byte arraylength- bytes to write- Returns:
- current output stream
- Throws:
IOException- when failed to write value into output stream, not able to sent all bytes, or opereate on a closed stream
-
writeByte
public ClickHouseOutputStream writeByte(byte b) throws IOException
Description copied from class:ClickHouseOutputStreamWrites a single byte into output stream.- Specified by:
writeBytein classClickHouseOutputStream- Parameters:
b- byte to write- Returns:
- current output stream
- Throws:
IOException- when failed to write value into output stream, not able to sent all bytes, or opereate on a closed stream
-
writeBytes
public ClickHouseOutputStream writeBytes(byte[] bytes, int offset, int length) throws IOException
Description copied from class:ClickHouseOutputStreamWrites copy of given bytes into output stream.- Specified by:
writeBytesin classClickHouseOutputStream- Parameters:
bytes- non-null byte arrayoffset- offset of the byte arraylength- bytes to write- Returns:
- current output stream
- Throws:
IOException- when failed to write value into output stream, not able to sent all bytes, or opereate on a closed stream
-
writeCustom
public ClickHouseOutputStream writeCustom(ClickHouseDataUpdater writer) throws IOException
Description copied from class:ClickHouseOutputStreamWrites bytes using custom writer.- Specified by:
writeCustomin classClickHouseOutputStream- Parameters:
writer- non-null data writer- Returns:
- current output stream
- Throws:
IOException- when failed to write value into output stream, not able to sent all bytes, or opereate on a closed stream
-
-