Class ArrowBuffer.Builder<T>
The ArrowBuffer.Builder<T> class is able to append value-type items, with fluent-style methods, to build up an ArrowBuffer of contiguous items.
public class ArrowBuffer.Builder<T> where T : struct
Type Parameters
T
Value-type of item to build into a buffer.
- Inheritance
-
ArrowBuffer.Builder<T>
- Inherited Members
Remarks
Note that bool is not supported as a generic type argument for this class. Please use ArrowBuffer.BitmapBuilder instead.
Constructors
Builder(int)
Creates an instance of the ArrowBuffer.Builder<T> class.
public Builder(int capacity = 8)
Parameters
capacity
intNumber of items of initial capacity to reserve.
Properties
Capacity
Gets the number of items that can be contained in the memory allocated by the current instance.
public int Capacity { get; }
Property Value
Length
Gets the number of items currently appended.
public int Length { get; }
Property Value
Memory
Gets the raw byte memory underpinning the builder.
public Memory<byte> Memory { get; }
Property Value
Span
Gets the span of memory underpinning the builder.
public Span<T> Span { get; }
Property Value
- Span<T>
Methods
Append(ArrowBuffer)
Append a buffer, assumed to contain items of the same type.
public ArrowBuffer.Builder<T> Append(ArrowBuffer buffer)
Parameters
buffer
ArrowBufferBuffer to append.
Returns
- ArrowBuffer.Builder<T>
Returns the builder (for fluent-style composition).
Append(ReadOnlySpan<T>)
Append a span of items.
public ArrowBuffer.Builder<T> Append(ReadOnlySpan<T> source)
Parameters
source
ReadOnlySpan<T>Source of item span.
Returns
- ArrowBuffer.Builder<T>
Returns the builder (for fluent-style composition).
Append(T)
Append a single item.
public ArrowBuffer.Builder<T> Append(T value)
Parameters
value
TItem to append.
Returns
- ArrowBuffer.Builder<T>
Returns the builder (for fluent-style composition).
AppendRange(IEnumerable<T>)
Append a number of items.
public ArrowBuffer.Builder<T> AppendRange(IEnumerable<T> values)
Parameters
values
IEnumerable<T>Items to append.
Returns
- ArrowBuffer.Builder<T>
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.Builder<T> Clear()
Returns
- ArrowBuffer.Builder<T>
Returns the builder (for fluent-style composition).
Reserve(int)
Reserve a given number of items' additional capacity.
public ArrowBuffer.Builder<T> Reserve(int additionalCapacity)
Parameters
additionalCapacity
intNumber of items of required additional capacity.
Returns
- ArrowBuffer.Builder<T>
Returns the builder (for fluent-style composition).
Resize(int)
Resize the buffer to a given size.
public ArrowBuffer.Builder<T> Resize(int capacity)
Parameters
capacity
intNumber of items of required capacity.
Returns
- ArrowBuffer.Builder<T>
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.