Package ru.yandex.clickhouse.util
Class ClickHouseRowBinaryStream
- java.lang.Object
-
- ru.yandex.clickhouse.util.ClickHouseRowBinaryStream
-
public class ClickHouseRowBinaryStream extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static longMILLIS_IN_DAY
-
Constructor Summary
Constructors Constructor Description ClickHouseRowBinaryStream(OutputStream outputStream, TimeZone timeZone, ClickHouseProperties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidmarkNextNullable(boolean isNullable)Write a marker indicating if value is nullable or not.voidwriteBigInteger(BigInteger value, int byteLength)voidwriteBitmap(ClickHouseBitmap rb)voidwriteByte(byte b)Dangerous.voidwriteByteBuffer(ByteBuffer buffer)voidwriteBytes(byte[] bytes)Dangerous.voidwriteBytes(byte[] bytes, int offset, int len)voidwriteDate(Date date)voidwriteDateArray(Date[] dates)voidwriteDateTime(Date date)voidwriteDateTimeArray(Date[] dates)voidwriteDecimal128(BigDecimal num, int scale)voidwriteDecimal256(BigDecimal num, int scale)voidwriteDecimal32(BigDecimal num, int scale)voidwriteDecimal64(BigDecimal num, int scale)voidwriteFixedString(String string)Write string with predefined proper length.voidwriteFixedString(String string, Integer len)Write string with any length, but it will be corrected, cut or extended to lenvoidwriteFloat32(float value)voidwriteFloat32Array(float[] floats)voidwriteFloat64(double value)voidwriteFloat64Array(double[] doubles)voidwriteInt128(BigInteger value)voidwriteInt16(int value)voidwriteInt16(short value)voidwriteInt16Array(short[] shorts)voidwriteInt256(BigInteger value)voidwriteInt32(int value)voidwriteInt32Array(int[] ints)voidwriteInt64(long value)voidwriteInt64Array(long[] longs)voidwriteInt8(byte value)voidwriteInt8(int value)voidwriteInt8Array(byte[] bytes)voidwriteInt8Array(int[] ints)voidwriteString(String string)voidwriteStringArray(String[] strings)voidwriteUInt128(BigInteger value)voidwriteUInt16(int value)voidwriteUInt16Array(int[] ints)voidwriteUInt256(BigInteger value)voidwriteUInt32(long value)voidwriteUInt32Array(long[] longs)voidwriteUInt64(long value)voidwriteUInt64(BigInteger value)voidwriteUInt64Array(long[] longs)voidwriteUInt64Array(BigInteger[] longs)voidwriteUInt8(boolean value)voidwriteUInt8(int value)voidwriteUInt8Array(int[] ints)voidwriteUnsignedLeb128(int value)voidwriteUUID(UUID uuid)voidwriteUUIDArray(UUID[] uuids)
-
-
-
Constructor Detail
-
ClickHouseRowBinaryStream
public ClickHouseRowBinaryStream(OutputStream outputStream, TimeZone timeZone, ClickHouseProperties properties)
-
-
Method Detail
-
writeUnsignedLeb128
public void writeUnsignedLeb128(int value) throws IOException- Throws:
IOException
-
writeBytes
public void writeBytes(byte[] bytes) throws IOExceptionDangerous. Can only be used for rare optimizations, for example when the string is written in parts without prior concatenation. The size of the string in bytes must be passed through writeUnsignedLeb128.- Parameters:
bytes- byte array will be written into stream- Throws:
IOException- in case if an I/O error occurs
-
writeByteBuffer
public void writeByteBuffer(ByteBuffer buffer) throws IOException
- Throws:
IOException
-
writeBytes
public void writeBytes(byte[] bytes, int offset, int len) throws IOException- Parameters:
bytes- byte array will be written into streamoffset- the starting offset inbytesto start writing atlen- the length of thebytes, starting fromoffset- Throws:
IOException- in case if an I/O error occurs
-
writeByte
public void writeByte(byte b) throws IOExceptionDangerous. Can only be used for rare optimizations, for example when the string is written in parts without prior concatenation. The size of the string in bytes must be passed through writeUnsignedLeb128.- Parameters:
b- byte value- Throws:
IOException- in case if an I/O error occurs
-
writeString
public void writeString(String string) throws IOException
- Throws:
IOException
-
writeFixedString
public void writeFixedString(String string) throws IOException
Write string with predefined proper length.- Parameters:
string- Input string- Throws:
IOException- in case if an I/O error occurs
-
writeFixedString
public void writeFixedString(String string, Integer len) throws IOException
Write string with any length, but it will be corrected, cut or extended to len- Parameters:
string- Input stringlen- Length of FixedString- Throws:
IOException- in case if an I/O error occurs
-
writeUInt8
public void writeUInt8(boolean value) throws IOException- Throws:
IOException
-
writeUInt8
public void writeUInt8(int value) throws IOException- Throws:
IOException
-
writeInt8
public void writeInt8(int value) throws IOException- Throws:
IOException
-
writeInt8
public void writeInt8(byte value) throws IOException- Throws:
IOException
-
writeInt16
public void writeInt16(int value) throws IOException- Throws:
IOException
-
writeInt16
public void writeInt16(short value) throws IOException- Throws:
IOException
-
writeUInt16
public void writeUInt16(int value) throws IOException- Throws:
IOException
-
writeInt32
public void writeInt32(int value) throws IOException- Throws:
IOException
-
writeUInt32
public void writeUInt32(long value) throws IOException- Throws:
IOException
-
writeInt64
public void writeInt64(long value) throws IOException- Throws:
IOException
-
writeUInt64
public void writeUInt64(long value) throws IOException- Throws:
IOException
-
writeUInt64
public void writeUInt64(BigInteger value) throws IOException
- Throws:
IOException
-
writeInt128
public void writeInt128(BigInteger value) throws IOException
- Throws:
IOException
-
writeUInt128
public void writeUInt128(BigInteger value) throws IOException
- Throws:
IOException
-
writeInt256
public void writeInt256(BigInteger value) throws IOException
- Throws:
IOException
-
writeUInt256
public void writeUInt256(BigInteger value) throws IOException
- Throws:
IOException
-
writeDateTime
public void writeDateTime(Date date) throws IOException
- Throws:
IOException
-
writeDate
public void writeDate(Date date) throws IOException
- Throws:
IOException
-
writeFloat32
public void writeFloat32(float value) throws IOException- Throws:
IOException
-
writeFloat64
public void writeFloat64(double value) throws IOException- Throws:
IOException
-
writeBigInteger
public void writeBigInteger(BigInteger value, int byteLength) throws IOException
- Throws:
IOException
-
writeDecimal128
public void writeDecimal128(BigDecimal num, int scale) throws IOException
- Throws:
IOException
-
writeDecimal256
public void writeDecimal256(BigDecimal num, int scale) throws IOException
- Throws:
IOException
-
writeDecimal64
public void writeDecimal64(BigDecimal num, int scale) throws IOException
- Throws:
IOException
-
writeDecimal32
public void writeDecimal32(BigDecimal num, int scale) throws IOException
- Throws:
IOException
-
writeDateArray
public void writeDateArray(Date[] dates) throws IOException
- Throws:
IOException
-
writeDateTimeArray
public void writeDateTimeArray(Date[] dates) throws IOException
- Throws:
IOException
-
writeStringArray
public void writeStringArray(String[] strings) throws IOException
- Throws:
IOException
-
writeInt8Array
public void writeInt8Array(byte[] bytes) throws IOException- Throws:
IOException
-
writeInt8Array
public void writeInt8Array(int[] ints) throws IOException- Throws:
IOException
-
writeUInt8Array
public void writeUInt8Array(int[] ints) throws IOException- Throws:
IOException
-
writeInt16Array
public void writeInt16Array(short[] shorts) throws IOException- Throws:
IOException
-
writeUInt16Array
public void writeUInt16Array(int[] ints) throws IOException- Throws:
IOException
-
writeInt32Array
public void writeInt32Array(int[] ints) throws IOException- Throws:
IOException
-
writeUInt32Array
public void writeUInt32Array(long[] longs) throws IOException- Throws:
IOException
-
writeInt64Array
public void writeInt64Array(long[] longs) throws IOException- Throws:
IOException
-
writeUInt64Array
public void writeUInt64Array(long[] longs) throws IOException- Throws:
IOException
-
writeUInt64Array
public void writeUInt64Array(BigInteger[] longs) throws IOException
- Throws:
IOException
-
writeFloat32Array
public void writeFloat32Array(float[] floats) throws IOException- Throws:
IOException
-
writeFloat64Array
public void writeFloat64Array(double[] doubles) throws IOException- Throws:
IOException
-
markNextNullable
public void markNextNullable(boolean isNullable) throws IOExceptionWrite a marker indicating if value is nullable or not.E.g., to write Nullable(Int32):
void writeNullableInt32(Integer value) { if (value == null) { markNextNullable(true); } else { markNextNullable(false); writeInt32(value); } }- Parameters:
isNullable- if it's true, 1 will be written otherwise 0- Throws:
IOException- in case if an I/O error occurs
-
writeUUID
public void writeUUID(UUID uuid) throws IOException
- Throws:
IOException
-
writeUUIDArray
public void writeUUIDArray(UUID[] uuids) throws IOException
- Throws:
IOException
-
writeBitmap
public void writeBitmap(ClickHouseBitmap rb) throws IOException
- Throws:
IOException
-
-