writeToStreamCompressed static method

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

Writes the NBT Data to stream in compressed mode

Implementation

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

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

  return _io.bytes;
}