Class ArrowBuffer.BitmapBuilder
The ArrowBuffer.BitmapBuilder class is a complement to ArrowBuffer.Builder<T> and is designed for boolean fields, which are efficiently bit-packed into byte-aligned memory.
public class ArrowBuffer.BitmapBuilder
- Inheritance
-
ArrowBuffer.BitmapBuilder
- Inherited Members
Constructors
BitmapBuilder(int)
Creates an instance of the ArrowBuffer.BitmapBuilder class.
public BitmapBuilder(int capacity = 64)
Parameters
capacity
intNumber of bits of initial capacity to reserve.
Properties
Capacity
Gets the number of bits that can be contained in the memory allocated by the current instance.
public int Capacity { get; }
Property Value
Length
Gets the number of bits currently appended.
public int Length { get; }
Property Value
Memory
Gets the raw byte memory underpinning the builder.
public Memory<byte> Memory { get; }
Property Value
SetBitCount
Gets the number of set bits (i.e. set to 1).
public int SetBitCount { get; }
Property Value
Span
Gets the span of (bit-packed byte) memory underpinning the builder.
public Span<byte> Span { get; }
Property Value
UnsetBitCount
Gets the number of unset bits (i.e. set to 0).
public int UnsetBitCount { get; }
Property Value
Methods
Append(bool)
Append a single bit.
public ArrowBuffer.BitmapBuilder Append(bool value)
Parameters
value
boolBit to append.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Append(ReadOnlySpan<byte>, int)
Append a span of bits.
public ArrowBuffer.BitmapBuilder Append(ReadOnlySpan<byte> source, int validBits)
Parameters
source
ReadOnlySpan<byte>Source of bits to append.
validBits
intNumber of valid bits in the source span.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
AppendRange(bool, int)
Append multiple bits.
public ArrowBuffer.BitmapBuilder AppendRange(bool value, int length)
Parameters
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
AppendRange(IEnumerable<bool>)
Append multiple bits.
public ArrowBuffer.BitmapBuilder AppendRange(IEnumerable<bool> values)
Parameters
values
IEnumerable<bool>Bits to append.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Build(MemoryAllocator)
Build an Arrow buffer from the appended contents so far.
public ArrowBuffer Build(MemoryAllocator allocator = null)
Parameters
allocator
MemoryAllocatorOptional memory allocator.
Returns
- ArrowBuffer
Returns an ArrowBuffer object.
Clear()
Clear all contents appended so far.
public ArrowBuffer.BitmapBuilder Clear()
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Reserve(int)
Reserve a given number of bits' additional capacity.
public ArrowBuffer.BitmapBuilder Reserve(int additionalCapacity)
Parameters
additionalCapacity
intNumber of bits of required additional capacity.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Resize(int)
Resize the buffer to a given size.
public ArrowBuffer.BitmapBuilder Resize(int capacity)
Parameters
capacity
intNumber of bits of required capacity.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Remarks
Note that if the required capacity is larger than the current length of the populated buffer so far, the buffer's contents in the new, expanded region are undefined.
Set(int)
Set the bit at a particular index to 1.
public ArrowBuffer.BitmapBuilder Set(int index)
Parameters
index
intIndex of bit to set.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Set(int, bool)
Set the bit at a particular index to a given value.
public ArrowBuffer.BitmapBuilder Set(int index, bool value)
Parameters
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Swap(int, int)
Swap the bits at two given indices.
public ArrowBuffer.BitmapBuilder Swap(int i, int j)
Parameters
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).
Toggle(int)
Toggle the bit at a particular index.
public ArrowBuffer.BitmapBuilder Toggle(int index)
Parameters
index
intIndex of bit to toggle.
Returns
- ArrowBuffer.BitmapBuilder
Returns the builder (for fluent-style composition).