padCount method

  1. @override
int padCount(
  1. Uint8List data
)
override

Get the number of pad bytes present in the block.

Implementation

@override
int padCount(Uint8List data) {
  var count = clip8(data[data.length - 1]);

  if (count > data.length || count == 0) {
    throw ArgumentError('Invalid or corrupted pad block');
  }

  for (var i = 1; i <= count; i++) {
    if (data[data.length - i] != count) {
      throw ArgumentError('Invalid or corrupted pad block');
    }
  }

  return count;
}