public abstract class AbstractBinaryWriter extends Object implements BinaryWriter
MemorySegment
(its capacity grows
automatically).
If write a format binary:
1. New a writer.
2. Write each field by writeXX or setNullAt. (Variable length fields can not be written
repeatedly.)
3. Invoke BinaryWriter.complete()
.
If want to reuse this writer, please invoke BinaryWriter.reset()
first.
Modifier and Type | Field and Description |
---|---|
protected int |
cursor |
protected DataOutputViewStreamWrapper |
outputView |
protected MemorySegment |
segment |
Constructor and Description |
---|
AbstractBinaryWriter() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
afterGrow()
After grow, need point to new memory.
|
protected void |
ensureCapacity(int neededSize) |
protected abstract int |
getFieldOffset(int pos)
Get field offset.
|
protected static int |
roundNumberOfBytesToNearestWord(int numBytes) |
protected abstract void |
setNullBit(int ordinal) |
protected abstract void |
setOffsetAndSize(int pos,
int offset,
long size)
Set offset and size to fix len part.
|
void |
writeArray(int pos,
BaseArray input,
BaseArraySerializer serializer) |
void |
writeBinary(int pos,
byte[] bytes) |
void |
writeDecimal(int pos,
Decimal value,
int precision) |
void |
writeGeneric(int pos,
BinaryGeneric input,
BinaryGenericSerializer serializer) |
void |
writeMap(int pos,
BaseMap input,
BaseMapSerializer serializer) |
void |
writeRow(int pos,
BaseRow input,
BaseRowSerializer serializer) |
void |
writeString(int pos,
BinaryString input)
|
protected void |
zeroOutPaddingBytes(int numBytes) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
complete, reset, setNullAt, write, writeBoolean, writeByte, writeDouble, writeFloat, writeInt, writeLong, writeShort
protected MemorySegment segment
protected int cursor
protected DataOutputViewStreamWrapper outputView
protected abstract void setOffsetAndSize(int pos, int offset, long size)
protected abstract int getFieldOffset(int pos)
protected abstract void afterGrow()
protected abstract void setNullBit(int ordinal)
public void writeString(int pos, BinaryString input)
writeString
in interface BinaryWriter
public void writeArray(int pos, BaseArray input, BaseArraySerializer serializer)
writeArray
in interface BinaryWriter
public void writeMap(int pos, BaseMap input, BaseMapSerializer serializer)
writeMap
in interface BinaryWriter
public void writeGeneric(int pos, BinaryGeneric input, BinaryGenericSerializer serializer)
writeGeneric
in interface BinaryWriter
public void writeRow(int pos, BaseRow input, BaseRowSerializer serializer)
writeRow
in interface BinaryWriter
public void writeBinary(int pos, byte[] bytes)
writeBinary
in interface BinaryWriter
public void writeDecimal(int pos, Decimal value, int precision)
writeDecimal
in interface BinaryWriter
protected void zeroOutPaddingBytes(int numBytes)
protected void ensureCapacity(int neededSize)
protected static int roundNumberOfBytesToNearestWord(int numBytes)
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.