mirror of https://github.com/apache/poi.git
[bug-65184] revert due to integration test failures
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1887660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
093fa9adb1
commit
9078e982c3
|
@ -54,32 +54,28 @@ public class POIFSMiniStore extends BlockStore {
|
||||||
/**
|
/**
|
||||||
* Load the block at the given offset.
|
* Load the block at the given offset.
|
||||||
*/
|
*/
|
||||||
protected ByteBuffer getBlockAt(final int offset) {
|
protected ByteBuffer getBlockAt(final int offset) throws IOException {
|
||||||
// Which big block is this?
|
// Which big block is this?
|
||||||
int byteOffset = offset * POIFSConstants.SMALL_BLOCK_SIZE;
|
int byteOffset = offset * POIFSConstants.SMALL_BLOCK_SIZE;
|
||||||
int bigBlockNumber = byteOffset / _filesystem.getBigBlockSize();
|
int bigBlockNumber = byteOffset / _filesystem.getBigBlockSize();
|
||||||
int bigBlockOffset = byteOffset % _filesystem.getBigBlockSize();
|
int bigBlockOffset = byteOffset % _filesystem.getBigBlockSize();
|
||||||
|
|
||||||
// Now locate the data block for it
|
// Now locate the data block for it
|
||||||
Iterator<Integer> it = _mini_stream.getBlockOffsetIterator();
|
Iterator<ByteBuffer> it = _mini_stream.getBlockIterator();
|
||||||
for (int i = 0; i < bigBlockNumber; i++) {
|
for (int i = 0; i < bigBlockNumber; i++) {
|
||||||
it.next();
|
it.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
ByteBuffer dataBlock = it.next();
|
||||||
ByteBuffer dataBlock = _filesystem.getBlockAt(it.next());
|
assert(dataBlock != null);
|
||||||
assert(dataBlock != null);
|
|
||||||
|
|
||||||
// Position ourselves, and take a slice
|
// Position ourselves, and take a slice
|
||||||
dataBlock.position(
|
dataBlock.position(
|
||||||
dataBlock.position() + bigBlockOffset
|
dataBlock.position() + bigBlockOffset
|
||||||
);
|
);
|
||||||
ByteBuffer miniBuffer = dataBlock.slice();
|
ByteBuffer miniBuffer = dataBlock.slice();
|
||||||
miniBuffer.limit(POIFSConstants.SMALL_BLOCK_SIZE);
|
miniBuffer.limit(POIFSConstants.SMALL_BLOCK_SIZE);
|
||||||
return miniBuffer;
|
return miniBuffer;
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue