Package com.clickhouse.client.stream
Class EmptyOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.clickhouse.client.ClickHouseOutputStream
-
- com.clickhouse.client.stream.EmptyOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public final class EmptyOutputStream extends ClickHouseOutputStream
Empty output stream consumes nothing and it can never be closed.
-
-
Field Summary
Fields Modifier and Type Field Description static EmptyOutputStreamINSTANCE-
Fields inherited from class com.clickhouse.client.ClickHouseOutputStream
closed, ERROR_INCOMPLETE_READ, ERROR_NULL_BYTES, ERROR_REUSE_BUFFER, ERROR_STREAM_CLOSED, file, postCloseAction
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisClosed()Checks if the output stream has been closed or not.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
empty, ensureOpen, getUnderlyingFile, 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
-
-
-
-
Field Detail
-
INSTANCE
public static final EmptyOutputStream INSTANCE
-
-
Method Detail
-
isClosed
public boolean isClosed()
Description copied from class:ClickHouseOutputStreamChecks if the output stream has been closed or not.- Overrides:
isClosedin classClickHouseOutputStream- Returns:
- true if the output stream has been closed; false otherwise
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classClickHouseOutputStream- 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
-
-