static string GetRootNameInternal([NotNull] Stream stream, bool bigEndian)
{
Debug.Assert(stream != null);
int firstByte = stream.ReadByte();
if (firstByte < 0) {
throw new EndOfStreamException();
} else if (firstByte != (int)NbtTagType.Compound) {
throw new NbtFormatException("Given NBT stream does not start with a TAG_Compound");
}
var reader = new NbtBinaryReader(stream, bigEndian);
return reader.ReadString();
}