BinaryRange.copy constructor Null safety

BinaryRange.copy(
  1. BinaryRange original
)

Creates a new binary range with the same values as another binary range.

The two ranges can then be used to process the bytes independently of each other. That is, the maintain separate begin offsets. Both ranges still share the same underlying bytes, so the bytes should not be modified until both ranges are no longer needed.

Implementation

BinaryRange.copy(BinaryRange original)
    : bytes = original.bytes,
      begin = original.begin,
      end = original.end;