Gfls.BytesRegionBuilder

Fields

None

Methods

append (sub_region_length, is_part_of_region)

get_current_size ()

Details

class Gfls.BytesRegionBuilder
append(sub_region_length, is_part_of_region)
Parameters:
  • sub_region_length (int) – the length of the sub-region. Must not be equal to 0.

  • is_part_of_region (bool) – whether the sub-region is part of the region.

Appends a sub-region at the end.

If is_part_of_region is False it creates a hole.

Contiguous sub-regions of the same kind are merged and will thus be treated as a single sub-region. So you can conveniently call this function several times in a row with the same value for is_part_of_region.

In order to create a Gfls.BytesRegion that will traverse a whole GLib.Bytes, it is required to call this function the right amount of times, even if it ends with a hole. See also Gfls.BytesRegion.match_bytes().

New in version 0.4.

get_current_size()
Returns:

the current total size, in number of bytes (holes included).

Return type:

int

New in version 0.4.