Class BitSequence.Builder (3.20.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
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public BitSequence.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
BitSequence.Builder
Overrides

build()

public BitSequence build()
Returns
TypeDescription
BitSequence

buildPartial()

public BitSequence buildPartial()
Returns
TypeDescription
BitSequence

clear()

public BitSequence.Builder clear()
Returns
TypeDescription
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
TypeDescription
BitSequence.Builder

This builder for chaining.

clearField(Descriptors.FieldDescriptor field)

public BitSequence.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
BitSequence.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public BitSequence.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
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
TypeDescription
BitSequence.Builder

This builder for chaining.

clone()

public BitSequence.Builder clone()
Returns
TypeDescription
BitSequence.Builder
Overrides

getBitmap()

public ByteString getBitmap()

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

bytes bitmap = 1;

Returns
TypeDescription
ByteString

The bitmap.

getDefaultInstanceForType()

public BitSequence getDefaultInstanceForType()
Returns
TypeDescription
BitSequence

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
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
TypeDescription
int

The padding.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
boolean
Overrides

mergeFrom(BitSequence other)

public BitSequence.Builder mergeFrom(BitSequence other)
Parameter
NameDescription
otherBitSequence
Returns
TypeDescription
BitSequence.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public BitSequence.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
BitSequence.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public BitSequence.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
BitSequence.Builder
Overrides

mergeUnknownFields(UnknownFieldSet unknownFields)

public final BitSequence.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
valueByteString

The bitmap to set.

Returns
TypeDescription
BitSequence.Builder

This builder for chaining.

setField(Descriptors.FieldDescriptor field, Object value)

public BitSequence.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
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
NameDescription
valueint

The padding to set.

Returns
TypeDescription
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
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
BitSequence.Builder
Overrides

setUnknownFields(UnknownFieldSet unknownFields)

public final BitSequence.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
BitSequence.Builder
Overrides