Table of Contents

Class ArrowBuffer.BitmapBuilder

Namespace
Apache.Arrow
Assembly
Apache.Arrow.dll

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 int

Number 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

int

Length

Gets the number of bits currently appended.

public int Length { get; }

Property Value

int

Memory

Gets the raw byte memory underpinning the builder.

public Memory<byte> Memory { get; }

Property Value

Memory<byte>

SetBitCount

Gets the number of set bits (i.e. set to 1).

public int SetBitCount { get; }

Property Value

int

Span

Gets the span of (bit-packed byte) memory underpinning the builder.

public Span<byte> Span { get; }

Property Value

Span<byte>

UnsetBitCount

Gets the number of unset bits (i.e. set to 0).

public int UnsetBitCount { get; }

Property Value

int

Methods

Append(bool)

Append a single bit.

public ArrowBuffer.BitmapBuilder Append(bool value)

Parameters

value bool

Bit 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 int

Number 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

value bool

Value of bits to append.

length int

Number of times the value should be added.

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 MemoryAllocator

Optional 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 int

Number 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 int

Number 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 int

Index 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

index int

Index of bit to set/unset.

value bool

Value of bit.

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

i int

First index.

j int

Second index.

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 int

Index of bit to toggle.

Returns

ArrowBuffer.BitmapBuilder

Returns the builder (for fluent-style composition).