writeToStreamCompressed static method

Uint8List writeToStreamCompressed(
  1. CompoundTag tag, [
  2. void onWriteListener(
    1. int
    )?
])

Writes the NBT Data to stream in compressed mode

Implementation

static Uint8List writeToStreamCompressed(CompoundTag tag,
    [void Function(int)? onWriteListener]) {
  _io.disposeStream();
  _io = ByteLayer();
  _io.addListener(onWriteListener);

  Tag.writeNamedTag(tag, _io);
  _io.compress();

  return _io.bytes;
}