java.lang.Object
org.apache.arrow.vector.ipc.WriteChannel
- All Implemented Interfaces:
AutoCloseable
Wrapper around a WritableByteChannel that maintains the position as well adding some common
serialization utilities.
All write methods in this class follow full write semantics, i.e., write calls only return after requested data has been fully written. Note this is different from java WritableByteChannel interface where partial write is allowed
Please note that objects of this class are not thread-safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongalign()Writes enough bytes to align the channel to an 8-byte boundary.voidclose()longstatic ByteBufferserialize(FBSerializable writer) Serializes writer to a ByteBuffer.longwrite(byte[] buffer) longwrite(ByteBuffer buffer) Writes all data frombufferto the underlying channel.voidWrites the buffer to the underlying channel.longwrite(FBSerializable writer, boolean withSizePrefix) Writes the serialized flatbuffer to the underlying channel.longwriteIntLittleEndian(int v) Writesvin little-endian format to the underlying channel.longwriteZeros(long zeroCount) WriteszeroCount zeros the underlying channel.
-
Constructor Details
-
WriteChannel
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
getCurrentPosition
public long getCurrentPosition() -
write
- Throws:
IOException
-
writeZeros
WriteszeroCount zeros the underlying channel.- Throws:
IOException
-
align
Writes enough bytes to align the channel to an 8-byte boundary.- Throws:
IOException
-
write
Writes all data frombufferto the underlying channel.- Throws:
IOException
-
writeIntLittleEndian
Writesvin little-endian format to the underlying channel.- Throws:
IOException
-
write
Writes the buffer to the underlying channel.- Throws:
IOException
-
write
Writes the serialized flatbuffer to the underlying channel. If withSizePrefix is true then the length in bytes of the buffer will first be written in little endian format.- Throws:
IOException
-
serialize
Serializes writer to a ByteBuffer.
-