read method

Reads the NBT data from the byte list. Throws NbtFileReadException if an issue occured.

Implementation

NbtCompound read() {
  try {
    root = NbtTag.readNewTag(this, null, withName: true) as NbtCompound;
  } on Exception catch (e) {
    if (e is NbtFileReadException) rethrow;
    throw NbtFileReadException('Failed to read file.');
  }
  if (root == null) throw NbtFileReadException('Failed to read file');
  return root!;
}