BlockWritable[] blocks = null; if (_big_store.isValid()) { blocks = _big_store.getBlocks(); } else if (_small_store.isValid()) {
/** * @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 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; }
BlockWritable[] blocks = null; if (_big_store.isValid()) { blocks = _big_store.getBlocks(); } else if (_small_store.isValid()) {
/** * 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); } } } }
/** * 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 number of big blocks making up this document */ int countBlocks() { if (isValid()) { if (_writer == null) { return bigBlocks.length; } return (_size + _bigBlockSize.getBigBlockSize() - 1) / _bigBlockSize.getBigBlockSize(); } return 0; } } // end private class BigBlockStore
/** * @return number of big blocks making up this document */ int countBlocks() { if (isValid()) { if (_writer == null) { return bigBlocks.length; } return (_size + _bigBlockSize.getBigBlockSize() - 1) / _bigBlockSize.getBigBlockSize(); } return 0; } } // end private class BigBlockStore