Exemplo n.º 1
0
        /**
         * Has our in-memory objects write their state
         *  to their backing blocks
         */
        private void syncWithDataSource()
        {
            // Mini Stream + SBATs first, as mini-stream details have
            //  to be stored in the Root Property
            _mini_store.SyncWithDataSource();

            // Properties
            NPOIFSStream propStream = new NPOIFSStream(this, _header.PropertyStart);

            _property_table.PreWrite();
            _property_table.Write(propStream);
            // _header.setPropertyStart has been updated on write ...
            // HeaderBlock
            HeaderBlockWriter hbw = new HeaderBlockWriter(_header);

            hbw.WriteBlock(GetBlockAt(-1));

            // BATs
            foreach (BATBlock bat in _bat_blocks)
            {
                ByteBuffer block = GetBlockAt(bat.OurBlockIndex);
                //byte[] block = GetBlockAt(bat.OurBlockIndex);
                BlockAllocationTableWriter.WriteBlock(bat, block);
            }
            // XBats
            foreach (BATBlock bat in _xbat_blocks)
            {
                ByteBuffer block = GetBlockAt(bat.OurBlockIndex);
                BlockAllocationTableWriter.WriteBlock(bat, block);
            }
        }
Exemplo n.º 2
0
        /**
         * Has our in-memory objects write their state
         *  to their backing blocks 
         */
        private void syncWithDataSource()
        {
            // HeaderBlock
            HeaderBlockWriter hbw = new HeaderBlockWriter(_header);
            hbw.WriteBlock(GetBlockAt(-1));

            // BATs
            foreach (BATBlock bat in _bat_blocks)
            {
                ByteBuffer block = GetBlockAt(bat.OurBlockIndex);
                //byte[] block = GetBlockAt(bat.OurBlockIndex);
                BlockAllocationTableWriter.WriteBlock(bat, block);
            }

            // SBATs
            _mini_store.SyncWithDataSource();

            // Properties
            _property_table.Write(new NPOIFSStream(this, _header.PropertyStart)
        );
        }