fNbt.NbtFile.GetRootNameInternal C# (CSharp) Method

GetRootNameInternal() private method

private GetRootNameInternal ( [ stream, bool bigEndian ) : string
stream [
bigEndian bool
return string
        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();
        }