/** * 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) ); }
/** * 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) ); }
/** * Returns the BATBlock that handles the specified offset, * and the relative index within it, for the mini stream. * The List of BATBlocks must be in sequential order */ public static BATBlockAndIndex getSBATBlockAndIndex(final int offset, final HeaderBlock header, final List<BATBlock> sbats) { POIFSBigBlockSize bigBlockSize = header.getBigBlockSize(); // SBATs are so much easier, as they're chained streams int whichSBAT = (int)Math.floor(offset / bigBlockSize.getBATEntriesPerBlock()); int index = offset % bigBlockSize.getBATEntriesPerBlock(); return new BATBlockAndIndex( index, sbats.get(whichSBAT) ); }
/** * Returns the BATBlock that handles the specified offset, * and the relative index within it, for the mini stream. * The List of BATBlocks must be in sequential order */ public static BATBlockAndIndex getSBATBlockAndIndex(final int offset, final HeaderBlock header, final List<BATBlock> sbats) { POIFSBigBlockSize bigBlockSize = header.getBigBlockSize(); // SBATs are so much easier, as they're chained streams int whichSBAT = (int)Math.floor(offset / bigBlockSize.getBATEntriesPerBlock()); int index = offset % bigBlockSize.getBATEntriesPerBlock(); return new BATBlockAndIndex( index, sbats.get(whichSBAT) ); }
/** * 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) ); }