/** @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); }
/** * Get an array of objects, some of which may implement POIFSViewable * * @return an array of Object; may not be null, but may be empty */ public Object[] getViewableArray() { String result = "<NO DATA>"; try { BlockWritable[] blocks = null; if (_big_store.isValid()) { blocks = _big_store.getBlocks(); } else if (_small_store.isValid()) { blocks = _small_store.getBlocks(); } if (blocks != null) { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (BlockWritable bw : blocks) { bw.writeBlocks(output); } int length = Math.min(output.size(), _property.getSize()); result = HexDump.dump(output.toByteArray(), 0, 0, length); } } catch (IOException e) { result = e.getMessage(); } return new String[] {result}; }
/** * Return the number of BigBlock's this instance uses * * @return count of BigBlock instances */ public int countBlocks() { return _big_store.countBlocks(); }
/** * Write the storage to an OutputStream * * @param stream the OutputStream to which the stored data should be written */ public void writeBlocks(OutputStream stream) throws IOException { _big_store.writeBlocks(stream); }