private POIFSFileSystem(boolean newFS) { _header = new HeaderBlock(bigBlockSize); _property_table = new PropertyTable(_header); _mini_store = new POIFSMiniStore(this, _property_table.getRoot(), new ArrayList<>(), _header); _xbat_blocks = new ArrayList<>(); _bat_blocks = new ArrayList<>(); _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(IOUtils.safelyAllocate( bigBlockSize.getBigBlockSize()*3, MAX_RECORD_LENGTH)); } }
return getBlockAt(offset); } catch(IndexOutOfBoundsException e) {} return createBlockIfNeeded(offset);
/** * Works out what block follows the specified one. */ protected int getNextBlock(final int offset) { BATBlockAndIndex bai = getBATBlockAndIndex(offset); return bai.getBlock().getValueAt( bai.getIndex() ); }
if (streamBlockSize < bigBlockSize) { _stream = new POIFSStream(_filesystem.getMiniStore()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(_filesystem);
_mini_store.syncWithDataSource();
/** * Constructor for an existing Document */ public POIFSDocument(DocumentProperty property, POIFSFileSystem filesystem) { this._property = property; this._filesystem = filesystem; if(property.getSize() < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new POIFSStream(_filesystem.getMiniStore(), property.getStartBlock()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(_filesystem, property.getStartBlock()); _block_size = _filesystem.getBlockStoreBlockSize(); } }
_mini_store.syncWithDataSource();
return getBlockAt(offset); } catch(IndexOutOfBoundsException e) {} return createBlockIfNeeded(offset);
public POIFSDocument(String name, final int size, POIFSFileSystem filesystem, POIFSWriterListener writer) throws IOException { this._filesystem = filesystem; if (size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new POIFSStream(filesystem.getMiniStore()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(filesystem); _block_size = _filesystem.getBlockStoreBlockSize(); } this._property = new DocumentProperty(name, size); _property.setStartBlock(_stream.getStartBlock()); _property.setDocument(this); try (DocumentOutputStream os = new DocumentOutputStream(this, size)) { POIFSDocumentPath path = new POIFSDocumentPath(name.split("\\\\")); String docName = path.getComponent(path.length() - 1); POIFSWriterEvent event = new POIFSWriterEvent(os, path, docName, size); writer.processPOIFSWriterEvent(event); } }
/** * 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 ); }
_mini_store = new POIFSMiniStore(this, _property_table.getRoot(), sbats, _header); nextAt = _header.getSBATStart(); for(int i=0; i<_header.getSBATCount() && nextAt != POIFSConstants.END_OF_CHAIN; i++) {
if (streamBlockSize < bigBlockSize) { _stream = new POIFSStream(_filesystem.getMiniStore()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(_filesystem);
/** * 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 POIFSFileSystem(boolean newFS) { _header = new HeaderBlock(bigBlockSize); _property_table = new PropertyTable(_header); _mini_store = new POIFSMiniStore(this, _property_table.getRoot(), new ArrayList<>(), _header); _xbat_blocks = new ArrayList<>(); _bat_blocks = new ArrayList<>(); _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(IOUtils.safelyAllocate( bigBlockSize.getBigBlockSize()*3, MAX_RECORD_LENGTH)); } }
/** * Constructor for an existing Document */ public POIFSDocument(DocumentProperty property, POIFSFileSystem filesystem) { this._property = property; this._filesystem = filesystem; if(property.getSize() < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new POIFSStream(_filesystem.getMiniStore(), property.getStartBlock()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(_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 POIFSMiniStore(this, _property_table.getRoot(), sbats, _header); nextAt = _header.getSBATStart(); for(int i=0; i<_header.getSBATCount() && nextAt != POIFSConstants.END_OF_CHAIN; i++) {
public POIFSDocument(String name, final int size, POIFSFileSystem filesystem, POIFSWriterListener writer) throws IOException { this._filesystem = filesystem; if (size < POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE) { _stream = new POIFSStream(filesystem.getMiniStore()); _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize(); } else { _stream = new POIFSStream(filesystem); _block_size = _filesystem.getBlockStoreBlockSize(); } this._property = new DocumentProperty(name, size); _property.setStartBlock(_stream.getStartBlock()); _property.setDocument(this); try (DocumentOutputStream os = new DocumentOutputStream(this, size)) { POIFSDocumentPath path = new POIFSDocumentPath(name.split("\\\\")); String docName = path.getComponent(path.length() - 1); POIFSWriterEvent event = new POIFSWriterEvent(os, path, docName, size); writer.processPOIFSWriterEvent(event); } }