private NPOIFSFileSystem(boolean newFS) { _header = new HeaderBlock(bigBlockSize); _property_table = new NPropertyTable(_header); _mini_store = new NPOIFSMiniStore(this, _property_table.getRoot(), new ArrayList<BATBlock>(), _header); _xbat_blocks = new ArrayList<BATBlock>(); _bat_blocks = new ArrayList<BATBlock>(); _root = null; if(newFS) { // Data needs to initially hold just the header block, // a single bat block, and an empty properties section _data = new ByteArrayBackedDataSource(new byte[bigBlockSize.getBigBlockSize()*3]); } }
/** * Changes the record of what block follows the specified one. */ protected void setNextBlock(final int offset, final int nextBlock) { BATBlockAndIndex bai = getBATBlockAndIndex(offset); bai.getBlock().setValueAt( bai.getIndex(), nextBlock ); }
return getBlockAt(offset); } catch(IndexOutOfBoundsException e) { return createBlockIfNeeded(offset);
_block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(filesystem);
/** * Has our in-memory objects write their state * to their backing blocks */ private void syncWithDataSource() throws IOException { // HeaderBlock HeaderBlockWriter hbw = new HeaderBlockWriter(_header); hbw.writeBlock( getBlockAt(-1) ); // BATs for(BATBlock bat : _bat_blocks) { ByteBuffer block = getBlockAt(bat.getOurBlockIndex()); BlockAllocationTableWriter.writeBlock(bat, block); } // SBATs _mini_store.syncWithDataSource(); // Properties _property_table.write( new NPOIFSStream(this, _header.getPropertyStart()) ); }
return getBlockAt(offset); } catch(IndexOutOfBoundsException e) { return createBlockIfNeeded(offset);
_block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(filesystem);
/** * Has our in-memory objects write their state * to their backing blocks */ private void syncWithDataSource() throws IOException { // HeaderBlock HeaderBlockWriter hbw = new HeaderBlockWriter(_header); hbw.writeBlock( getBlockAt(-1) ); // BATs for(BATBlock bat : _bat_blocks) { ByteBuffer block = getBlockAt(bat.getOurBlockIndex()); BlockAllocationTableWriter.writeBlock(bat, block); } // SBATs _mini_store.syncWithDataSource(); // Properties _property_table.write( new NPOIFSStream(this, _header.getPropertyStart()) ); }
/** * Changes the record of what block follows the specified one. */ protected void setNextBlock(final int offset, final int nextBlock) { BATBlockAndIndex bai = getBATBlockAndIndex(offset); bai.getBlock().setValueAt( bai.getIndex(), nextBlock ); }
private NPOIFSFileSystem(boolean newFS) { _header = new HeaderBlock(bigBlockSize); _property_table = new NPropertyTable(_header); _mini_store = new NPOIFSMiniStore(this, _property_table.getRoot(), new ArrayList<BATBlock>(), _header); _xbat_blocks = new ArrayList<BATBlock>(); _bat_blocks = new ArrayList<BATBlock>(); _root = null; if(newFS) { // Data needs to initially hold just the header block, // a single bat block, and an empty properties section _data = new ByteArrayBackedDataSource(new byte[bigBlockSize.getBigBlockSize()*3]); } }
/** * Constructor for an existing Document */ public NPOIFSDocument(DocumentProperty property, NPOIFSFileSystem filesystem) throws IOException { this._property = property; this._filesystem = filesystem; if(property.getSize() < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(_filesystem.getMiniStore(), property.getStartBlock()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(_filesystem, property.getStartBlock()); _block_size = _filesystem.getBlockStoreBlockSize(); } }
/** * Works out what block follows the specified one. */ protected int getNextBlock(final int offset) { BATBlockAndIndex bai = getBATBlockAndIndex(offset); return bai.getBlock().getValueAt( bai.getIndex() ); }
_mini_store = new NPOIFSMiniStore(this, _property_table.getRoot(), sbats, _header); nextAt = _header.getSBATStart(); for(int i=0; i<_header.getSBATCount(); i++) {
/** * Constructor for an existing Document */ public NPOIFSDocument(DocumentProperty property, NPOIFSFileSystem filesystem) throws IOException { this._property = property; this._filesystem = filesystem; if(property.getSize() < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new NPOIFSStream(_filesystem.getMiniStore(), property.getStartBlock()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new NPOIFSStream(_filesystem, property.getStartBlock()); _block_size = _filesystem.getBlockStoreBlockSize(); } }
/** * Works out what block follows the specified one. */ protected int getNextBlock(final int offset) { BATBlockAndIndex bai = getBATBlockAndIndex(offset); return bai.getBlock().getValueAt( bai.getIndex() ); }
_mini_store = new NPOIFSMiniStore(this, _property_table.getRoot(), sbats, _header); nextAt = _header.getSBATStart(); for(int i=0; i<_header.getSBATCount(); i++) {