fNbt.NbtFile.LoadFromStreamInternal C# (CSharp) Method

LoadFromStreamInternal() private method

private LoadFromStreamInternal ( [ stream, [ tagSelector ) : void
stream [
tagSelector [
return void
        void LoadFromStreamInternal([NotNull] Stream stream, [CanBeNull] TagSelector tagSelector)
        {
            // Make sure the first byte in this file is the tag for a TAG_Compound
            int firstByte = stream.ReadByte();
            if (firstByte < 0) {
                throw new EndOfStreamException();
            }
            if (firstByte != (int)NbtTagType.Compound) {
                throw new NbtFormatException("Given NBT stream does not start with a TAG_Compound");
            }
            var reader = new NbtBinaryReader(stream, BigEndian) {
                Selector = tagSelector
            };

            var rootCompound = new NbtCompound(reader.ReadString());
            rootCompound.ReadTag(reader);
            RootTag = rootCompound;
        }