private static DocumentBlock[] convertRawBlocksToBigBlocks(ListManagedBlock[] blocks) throws IOException { DocumentBlock[] result = new DocumentBlock[blocks.length]; for (int i = 0; i < result.length; i++) { result[i] = new DocumentBlock((RawDataBlock)blocks[i]); } return result; } private static SmallDocumentBlock[] convertRawBlocksToSmallBlocks(ListManagedBlock[] blocks) {
/** * Write the block's data to an OutputStream * * @param stream the OutputStream to which the stored data should * be written * * @exception IOException on problems writing to the specified * stream */ void writeData(final OutputStream stream) throws IOException { doWriteData(stream, _data); }
_bigBigBlockSize = bigBlockSize; while (true) { DocumentBlock block = new DocumentBlock(stream, bigBlockSize); int blockSize = block.size(); _size += blockSize; if (block.partiallyRead()) { break;
/** * write the blocks to a stream * * @param stream the stream to which the data is to be written */ void writeBlocks(OutputStream stream) throws IOException { if (isValid()) { if (_writer != null) { DocumentOutputStream dstream = new DocumentOutputStream(stream, _size); _writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size)); dstream.writeFiller(countBlocks() * _bigBlockSize.getBigBlockSize(), DocumentBlock.getFillByte()); } else { for (int k = 0; k < bigBlocks.length; k++) { bigBlocks[k].writeBlocks(stream); } } } }
/** * @return the DocumentBlocks */ DocumentBlock[] getBlocks() { if (isValid() && _writer != null) { ByteArrayOutputStream stream = new ByteArrayOutputStream(_size); DocumentOutputStream dstream = new DocumentOutputStream(stream, _size); _writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size)); bigBlocks = DocumentBlock.convert(_bigBlockSize, stream.toByteArray(), _size); } return bigBlocks; }
/** * @return <code>null</code> if <tt>offset</tt> points to the end of the document stream */ DataInputBlock getDataInputBlock(int offset) { if (offset >= _size) { if (offset > _size) { throw new RuntimeException("Request for Offset " + offset + " doc size is " + _size); } return null; } if (_property.shouldUseSmallBlocks()) { return SmallDocumentBlock.getDataInputBlock(_small_store.getBlocks(), offset); } return DocumentBlock.getDataInputBlock(_big_store.getBlocks(), offset); }
_bigBigBlockSize = bigBlockSize; while (true) { DocumentBlock block = new DocumentBlock(stream, bigBlockSize); int blockSize = block.size(); _size += blockSize; if (block.partiallyRead()) { break;
/** * write the blocks to a stream * * @param stream the stream to which the data is to be written */ void writeBlocks(OutputStream stream) throws IOException { if (isValid()) { if (_writer != null) { DocumentOutputStream dstream = new DocumentOutputStream(stream, _size); _writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size)); dstream.writeFiller(countBlocks() * _bigBlockSize.getBigBlockSize(), DocumentBlock.getFillByte()); } else { for (int k = 0; k < bigBlocks.length; k++) { bigBlocks[k].writeBlocks(stream); } } } }
/** * @return the DocumentBlocks */ DocumentBlock[] getBlocks() { if (isValid() && _writer != null) { ByteArrayOutputStream stream = new ByteArrayOutputStream(_size); DocumentOutputStream dstream = new DocumentOutputStream(stream, _size); _writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size)); bigBlocks = DocumentBlock.convert(_bigBlockSize, stream.toByteArray(), _size); } return bigBlocks; }
/** * @return <code>null</code> if <tt>offset</tt> points to the end of the document stream */ DataInputBlock getDataInputBlock(int offset) { if (offset >= _size) { if (offset > _size) { throw new RuntimeException("Request for Offset " + offset + " doc size is " + _size); } return null; } if (_property.shouldUseSmallBlocks()) { return SmallDocumentBlock.getDataInputBlock(_small_store.getBlocks(), offset); } return DocumentBlock.getDataInputBlock(_big_store.getBlocks(), offset); }
private static DocumentBlock[] convertRawBlocksToBigBlocks(ListManagedBlock[] blocks) throws IOException { DocumentBlock[] result = new DocumentBlock[blocks.length]; for (int i = 0; i < result.length; i++) { result[i] = new DocumentBlock((RawDataBlock)blocks[i]); } return result; } private static SmallDocumentBlock[] convertRawBlocksToSmallBlocks(ListManagedBlock[] blocks) {
/** * Write the block's data to an OutputStream * * @param stream the OutputStream to which the stored data should * be written * * @exception IOException on problems writing to the specified * stream */ void writeData(final OutputStream stream) throws IOException { doWriteData(stream, _data); }
rval[ k ] = new DocumentBlock(bigBlockSize); if (offset < array.length)
rval[ k ] = new DocumentBlock(bigBlockSize); if (offset < array.length)