/** * Returns the BATBlock that handles the specified offset, * and the relative index within it. * The List of BATBlocks must be in sequential order */ public static BATBlockAndIndex getBATBlockAndIndex(final int offset, final HeaderBlock header, final List<BATBlock> bats) { POIFSBigBlockSize bigBlockSize = header.getBigBlockSize(); int entriesPerBlock = bigBlockSize.getBATEntriesPerBlock(); int whichBAT = offset / entriesPerBlock; int index = offset % entriesPerBlock; return new BATBlockAndIndex( index, bats.get(whichBAT) ); }
public PropertyTable(HeaderBlock headerBlock) { _header_block = headerBlock; _bigBigBlockSize = headerBlock.getBigBlockSize(); addProperty(new RootProperty()); }
public static long calculateMaximumSize(final HeaderBlock header) { return calculateMaximumSize(header.getBigBlockSize(), header.getBATCount()); }
PropertyTable(final HeaderBlock headerBlock, final Iterable<ByteBuffer> dataSource) throws IOException { _header_block = headerBlock; _bigBigBlockSize = headerBlock.getBigBlockSize(); for (ByteBuffer bb : dataSource) { // Turn it into an array byte[] data; if (bb.hasArray() && bb.arrayOffset() == 0 && bb.array().length == _bigBigBlockSize.getBigBlockSize()) { data = bb.array(); } else { data = IOUtils.safelyAllocate(_bigBigBlockSize.getBigBlockSize(), MAX_RECORD_LENGTH); int toRead = data.length; if (bb.remaining() < _bigBigBlockSize.getBigBlockSize()) { // Looks to be a truncated block // This isn't allowed, but some third party created files // sometimes do this, and we can normally read anyway _logger.log(POILogger.WARN, "Short Property Block, ", bb.remaining(), " bytes instead of the expected " + _bigBigBlockSize.getBigBlockSize()); toRead = bb.remaining(); } bb.get(data, 0, toRead); } PropertyFactory.convertToProperties(data, _properties); } populatePropertyTree( (DirectoryProperty)_properties.get(0)); }
_header.getBigBlockSize().getBigBlockSize() ); _header.writeData(baos);
bigBlockSize = _header.getBigBlockSize();
public PropertyTable(HeaderBlock headerBlock) { super(headerBlock); _bigBigBlockSize = headerBlock.getBigBlockSize(); _blocks = null; }
public NPropertyTable(HeaderBlock headerBlock) { super(headerBlock); _bigBigBlockSize = headerBlock.getBigBlockSize(); }
public PropertyTable(HeaderBlock headerBlock) { super(headerBlock); _bigBigBlockSize = headerBlock.getBigBlockSize(); _blocks = null; }
public NPropertyTable(HeaderBlock headerBlock) { super(headerBlock); _bigBigBlockSize = headerBlock.getBigBlockSize(); }
DIFAT(HeaderBlock header, final XlsInputStream is) { super(is, header, header.getBigBlockSize().getBigBlockSize()); bigBlockSize = header.getBigBlockSize(); readAllBATs(); }
/** * Returns the BATBlock that handles the specified offset, * and the relative index within it. * The List of BATBlocks must be in sequential order */ public static BATBlockAndIndex getBATBlockAndIndex(final int offset, final HeaderBlock header, final List<BATBlock> bats) { POIFSBigBlockSize bigBlockSize = header.getBigBlockSize(); int entriesPerBlock = bigBlockSize.getBATEntriesPerBlock(); int whichBAT = offset / entriesPerBlock; int index = offset % entriesPerBlock; return new BATBlockAndIndex( index, bats.get(whichBAT) ); }
/** * Returns the BATBlock that handles the specified offset, * and the relative index within it. * The List of BATBlocks must be in sequential order */ public static BATBlockAndIndex getBATBlockAndIndex(final int offset, final HeaderBlock header, final List<BATBlock> bats) { POIFSBigBlockSize bigBlockSize = header.getBigBlockSize(); int whichBAT = (int)Math.floor(offset / bigBlockSize.getBATEntriesPerBlock()); int index = offset % bigBlockSize.getBATEntriesPerBlock(); return new BATBlockAndIndex( index, bats.get(whichBAT) ); }
public PropertyTable(HeaderBlock headerBlock) { _header_block = headerBlock; _bigBigBlockSize = headerBlock.getBigBlockSize(); addProperty(new RootProperty()); }
public static long calculateMaximumSize(final HeaderBlock header) { return calculateMaximumSize(header.getBigBlockSize(), header.getBATCount()); }
/** * Returns the BATBlock that handles the specified offset, * and the relative index within it. * The List of BATBlocks must be in sequential order */ public static BATBlockAndIndex getBATBlockAndIndex(final int offset, final HeaderBlock header, final List<BATBlock> bats) { POIFSBigBlockSize bigBlockSize = header.getBigBlockSize(); int whichBAT = (int)Math.floor(offset / bigBlockSize.getBATEntriesPerBlock()); int index = offset % bigBlockSize.getBATEntriesPerBlock(); return new BATBlockAndIndex( index, bats.get(whichBAT) ); }
public static void displayHeader(HeaderBlock header_block) throws Exception { System.out.println("Header Details:"); System.out.println(" Block size: " + header_block.getBigBlockSize().getBigBlockSize()); System.out.println(" BAT (FAT) header blocks: " + header_block.getBATArray().length); System.out.println(" BAT (FAT) block count: " + header_block.getBATCount()); System.out.println(" XBAT (FAT) block count: " + header_block.getXBATCount()); System.out.println(" XBAT (FAT) block 1 at: " + header_block.getXBATIndex()); System.out.println(" SBAT (MiniFAT) block count: " + header_block.getSBATCount()); System.out.println(" SBAT (MiniFAT) block 1 at: " + header_block.getSBATStart()); System.out.println(" Property table at: " + header_block.getPropertyStart()); System.out.println(""); }
public static void displayHeader(HeaderBlock header_block) throws Exception { System.out.println("Header Details:"); System.out.println(" Block size: " + header_block.getBigBlockSize().getBigBlockSize()); System.out.println(" BAT (FAT) header blocks: " + header_block.getBATArray().length); System.out.println(" BAT (FAT) block count: " + header_block.getBATCount()); System.out.println(" XBAT (FAT) block count: " + header_block.getXBATCount()); System.out.println(" XBAT (FAT) block 1 at: " + header_block.getXBATIndex()); System.out.println(" SBAT (MiniFAT) block count: " + header_block.getSBATCount()); System.out.println(" SBAT (MiniFAT) block 1 at: " + header_block.getSBATStart()); System.out.println(" Property table at: " + header_block.getPropertyStart()); System.out.println(""); }
public MiniStore(final XlsInputStream is, DirectoryProperty root, HeaderBlock header, BlockStore difats) { super(is, header, POIFSConstants.SMALL_BLOCK_SIZE); this.root = root; this.difats = difats; // load all mini-FAT blocks int nextAt = header.getSBATStart(); for(int i = 0; i < header.getSBATCount() && nextAt != POIFSConstants.END_OF_CHAIN; i++) { BATBlock sfat = BATBlock.createBATBlock(header.getBigBlockSize(), difats.getBlockBuffer(nextAt)); sfat.setOurBlockIndex(nextAt); blocks.add(sfat); nextAt = difats.getNextBlock(nextAt); } }
public PropertyTable(final XlsInputStream is, HeaderBlock header, BlockStore blockStore) { this.is = is; this.sectorSize = header.getBigBlockSize().getBigBlockSize(); // Directory sectors are stored as a chain starting from sector # header.propertyStart // and FAT table contains link to next sector in the chain int nextBlock = header.getPropertyStart(); // first sector in directory chain while (nextBlock != POIFSConstants.END_OF_CHAIN) { int blockOffset = blockStore.getBlockOffset(nextBlock); processSector(blockOffset); nextBlock = blockStore.getNextBlock(nextBlock); // get next block in the chain } populatePropertyTree((DirectoryProperty) properties.get(0)); }