Package org.apache.arrow.vector.ipc
Class WriteChannel
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
-
Method Summary
Modifier and TypeMethodDescriptionlong
align()
Writes enough bytes to align the channel to an 8-byte boundary.void
close()
long
static ByteBuffer
serialize
(FBSerializable writer) Serializes writer to a ByteBuffer.long
write
(byte[] buffer) long
write
(ByteBuffer buffer) Writes all data frombuffer
to the underlying channel.void
Writes the buffer to the underlying channel.long
write
(FBSerializable writer, boolean withSizePrefix) Writes the serialized flatbuffer to the underlying channel.long
writeIntLittleEndian
(int v) Writesv
in little-endian format to the underlying channel.long
writeZeros
(long zeroCount) WriteszeroCount zeros the underlying channel.
-
Constructor Details
-
WriteChannel
-
-
Method Details
-
close
- Specified by:
close
in 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 frombuffer
to the underlying channel.- Throws:
IOException
-
writeIntLittleEndian
Writesv
in 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.
-