예제 #1
0
        public Tree(Stream reader, Stream writer, StartMode mode)
        {
            this.reader  = reader;
            this.writer  = writer;
            binaryReader = new BinaryReaderWith7BitEncoding(this.reader);
            binaryWriter = new BinaryWriterWith7BitEncoding(this.writer);

            root = mode == StartMode.Create
                                ? new TreeNode(null, null, null, null, ReadNode, WriteNodeLazy)
                                : ReadNode(new StreamPosition(reader.Position, null));
        }
예제 #2
0
        public Bag(Stream reader, Stream writer, StartMode mode)
        {
            this.reader = reader;
            this.writer = writer;

            binaryReader = new BinaryReaderWith7BitEncoding(reader);
            binaryWriter = new BinaryWriterWith7BitEncoding(writer);

            if (mode != StartMode.Open)
            {
                return;
            }
            current = ReadItem(reader.Position);
        }
예제 #3
0
        public Queue(Stream reader, Stream writer, StartMode mode)
        {
            this.reader = reader;
            this.writer = writer;

            binaryReader = new BinaryReaderWith7BitEncoding(reader);
            binaryWriter = new BinaryWriterWith7BitEncoding(writer);

            if (mode == StartMode.Open)
            {
                currentId = binaryReader.Read7BitEncodedInt64();
                var treePos = binaryReader.Read7BitEncodedInt64();
                reader.Position = treePos;
            }
            tree = new Tree(reader, writer, mode);
        }