Class BitSequence.Builder (3.22.0)

public static final class BitSequence.Builder extends GeneratedMessageV3.Builder<BitSequence.Builder> implements BitSequenceOrBuilder

A sequence of bits, encoded in a byte array.

Each byte in the bitmap byte array stores 8 bits of the sequence. The only exception is the last byte, which may store 8 or fewer bits. The padding defines the number of bits of the last byte to be ignored as "padding". The values of these "padding" bits are unspecified and must be ignored.

To retrieve the first bit, bit 0, calculate: (bitmap[0] & 0x01) != 0. To retrieve the second bit, bit 1, calculate: (bitmap[0] & 0x02) != 0. To retrieve the third bit, bit 2, calculate: (bitmap[0] & 0x04) != 0. To retrieve the fourth bit, bit 3, calculate: (bitmap[0] & 0x08) != 0. To retrieve bit n, calculate: (bitmap[n / 8] & (0x01 << (n % 8))) != 0.

The "size" of a BitSequence (the number of bits it contains) is calculated by this formula: (bitmap.length * 8) - padding.

Protobuf type google.firestore.v1.BitSequence

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public BitSequence.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
BitSequence.Builder
Overrides

build()

public BitSequence build()
Returns
Type Description
BitSequence

buildPartial()

public BitSequence buildPartial()
Returns
Type Description
BitSequence

clear()

public BitSequence.Builder clear()
Returns
Type Description
BitSequence.Builder
Overrides

clearBitmap()

public BitSequence.Builder clearBitmap()

The bytes that encode the bit sequence. May have a length of zero.

bytes bitmap = 1;

Returns
Type Description
BitSequence.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public BitSequence.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
BitSequence.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public BitSequence.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
BitSequence.Builder
Overrides

clearPadding()

public BitSequence.Builder clearPadding()

The number of bits of the last byte in bitmap to ignore as "padding". If the length of bitmap is zero, then this value must be 0. Otherwise, this value must be between 0 and 7, inclusive.

int32 padding = 2;

Returns
Type Description
BitSequence.Builder

This builder for chaining.

clone()

public BitSequence.Builder clone()
Returns
Type Description
BitSequence.Builder
Overrides

getBitmap()

public ByteString getBitmap()

The bytes that encode the bit sequence. May have a length of zero.

bytes bitmap = 1;

Returns
Type Description
ByteString

The bitmap.

getDefaultInstanceForType()

public BitSequence getDefaultInstanceForType()
Returns
Type Description
BitSequence

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getPadding()

public int getPadding()

The number of bits of the last byte in bitmap to ignore as "padding". If the length of bitmap is zero, then this value must be 0. Otherwise, this value must be between 0 and 7, inclusive.

int32 padding = 2;

Returns
Type Description
int

The padding.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeFrom(BitSequence other)

public BitSequence.Builder mergeFrom(BitSequence other)
Parameter
Name Description
other BitSequence
Returns
Type Description
BitSequence.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public BitSequence.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
BitSequence.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public BitSequence.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
BitSequence.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final BitSequence.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
BitSequence.Builder
Overrides

setBitmap(ByteString value)

public BitSequence.Builder setBitmap(ByteString value)

The bytes that encode the bit sequence. May have a length of zero.

bytes bitmap = 1;

Parameter
Name Description
value ByteString

The bitmap to set.

Returns
Type Description
BitSequence.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public BitSequence.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
BitSequence.Builder
Overrides

setPadding(int value)

public BitSequence.Builder setPadding(int value)

The number of bits of the last byte in bitmap to ignore as "padding". If the length of bitmap is zero, then this value must be 0. Otherwise, this value must be between 0 and 7, inclusive.

int32 padding = 2;

Parameter
Name Description
value int

The padding to set.

Returns
Type Description
BitSequence.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public BitSequence.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
BitSequence.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final BitSequence.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
BitSequence.Builder
Overrides