/** * Gets the defragmented stream from this ole compound file * * @param streamName the stream name to get * @return the defragmented ole stream * @exception BiffException */ public byte[] getStream(String streamName) throws BiffException { PropertyStorage ps = findPropertyStorage(streamName, rootEntryPropertyStorage); // Property set can't be found from the direct hierarchy, so just // search on the name if (ps == null) { ps = getPropertyStorage(streamName); } if (ps.size >= SMALL_BLOCK_THRESHOLD || streamName.equalsIgnoreCase(ROOT_ENTRY_NAME)) { return getBigBlockStream(ps); } else { return getSmallBlockStream(ps); } }
/** * Gets the defragmented stream from this ole compound file. Used when * copying workbooks with macros * * @param psIndex the property storage index * @return the defragmented ole stream * @exception BiffException */ public byte[] getStream(int psIndex) throws BiffException { PropertyStorage ps = getPropertyStorage(psIndex); if (ps.size >= SMALL_BLOCK_THRESHOLD || ps.name.equalsIgnoreCase(ROOT_ENTRY_NAME)) { return getBigBlockStream(ps); } else { return getSmallBlockStream(ps); } }
PropertyStorage child = getPropertyStorage(base.child); if (child.name.equalsIgnoreCase(name)) while (prev.previous != -1) prev = getPropertyStorage(prev.previous); if (prev.name.equalsIgnoreCase(name)) while (next.next != -1) next = getPropertyStorage(next.next); if (next.name.equalsIgnoreCase(name)) return findPropertyStorage(name, child);
readBigBlockDepot(); readSmallBlockDepot(); rootEntry = readData(rootStartBlock); readPropertySets();
int blocksRequired = 0; int numPropertySets = readCompoundFile.getNumberOfPropertySets(); PropertyStorage ps = readCompoundFile.getPropertySet(i); PropertyStorage ps2 = readCompoundFile.findPropertyStorage(ps.name); Assert.verify(ps2 != null); if (ps.size > 0 ) data = readCompoundFile.getStream(i);
CompoundFile cf = new CompoundFile(d, ws); try data = cf.getStream("workbook"); data = cf.getStream("book"); (cf.getNumberOfPropertySets() > BaseCompoundFile.STANDARD_PROPERTY_SETS.length))
/** * Displays the properties to the output stream */ void displaySets() throws IOException { int numSets = compoundFile.getNumberOfPropertySets(); for (int i = 0; i < numSets ; i++) { BaseCompoundFile.PropertyStorage ps = compoundFile.getPropertySet(i); writer.write(Integer.toString(i)); writer.write(") "); writer.write(ps.name); writer.write("(type "); writer.write(Integer.toString(ps.type)); writer.write(" size "); writer.write(Integer.toString(ps.size)); writer.write(" prev " ); writer.write(Integer.toString(ps.previous)); writer.write(" next " ); writer.write(Integer.toString(ps.next)); writer.write(" child " ); writer.write(Integer.toString(ps.child)); writer.write(" start block " ); writer.write(Integer.toString(ps.startBlock)); writer.write(")"); writer.newLine(); } writer.flush(); writer.close(); }
/** * Gets the property set. Invoked when copying worksheets with macros. * Simply calls the private counterpart * * @param ps the property set name * @return the property set with the given name */ public PropertyStorage getPropertySet(int index) { return getPropertyStorage(index); } }
/** * Recursively searches the property storages in hierarchy order * for the appropriate name. This is the public version which is * invoked from the writable version * when copying a sheet with addition property sets. */ public PropertyStorage findPropertyStorage(String name) { return findPropertyStorage(name, rootEntryPropertyStorage); }
/** * Write the property stream to the output stream */ void displayPropertySet(String ps, OutputStream os) throws IOException,BiffException { if (ps.equalsIgnoreCase("SummaryInformation")) { ps = BaseCompoundFile.SUMMARY_INFORMATION_NAME; } else if (ps.equalsIgnoreCase("DocumentSummaryInformation")) { ps = BaseCompoundFile.DOCUMENT_SUMMARY_INFORMATION_NAME; } else if (ps.equalsIgnoreCase("CompObj")) { ps = BaseCompoundFile.COMP_OBJ_NAME; } byte[] stream = compoundFile.getStream(ps); os.write(stream); }
throws BiffException byte[] rootdata = readData(rootEntryPropertyStorage.startBlock); byte[] sbdata = new byte[0];
compoundFile = new CompoundFile(d, new WorkbookSettings()); fis.close();
readBigBlockDepot(); readSmallBlockDepot(); rootEntry = readData(rootStartBlock); readPropertySets();
int blocksRequired = 0; int numPropertySets = readCompoundFile.getNumberOfPropertySets(); PropertyStorage ps = readCompoundFile.getPropertySet(i); PropertyStorage ps2 = readCompoundFile.findPropertyStorage(ps.name); Assert.verify(ps2 != null); if (ps.size > 0 ) data = readCompoundFile.getStream(i);
/** * Gets the defragmented stream from this ole compound file. Used when * copying workbooks with macros * * @param psIndex the property storage index * @return the defragmented ole stream * @exception BiffException */ public byte[] getStream(int psIndex) throws BiffException { PropertyStorage ps = getPropertyStorage(psIndex); if (ps.size >= SMALL_BLOCK_THRESHOLD || ps.name.equalsIgnoreCase(ROOT_ENTRY_NAME)) { return getBigBlockStream(ps); } else { return getSmallBlockStream(ps); } }
CompoundFile cf = new CompoundFile(d, ws); try data = cf.getStream("workbook"); data = cf.getStream("book"); (cf.getNumberOfPropertySets() > BaseCompoundFile.STANDARD_PROPERTY_SETS.length))
/** * Displays the properties to the output stream */ void displaySets() throws IOException { int numSets = compoundFile.getNumberOfPropertySets(); for (int i = 0; i < numSets ; i++) { BaseCompoundFile.PropertyStorage ps = compoundFile.getPropertySet(i); writer.write(Integer.toString(i)); writer.write(") "); writer.write(ps.name); writer.write("(type "); writer.write(Integer.toString(ps.type)); writer.write(" size "); writer.write(Integer.toString(ps.size)); writer.write(" prev " ); writer.write(Integer.toString(ps.previous)); writer.write(" next " ); writer.write(Integer.toString(ps.next)); writer.write(" child " ); writer.write(Integer.toString(ps.child)); writer.write(" start block " ); writer.write(Integer.toString(ps.startBlock)); writer.write(")"); writer.newLine(); } writer.flush(); writer.close(); }
PropertyStorage child = getPropertyStorage(base.child); if (child.name.equalsIgnoreCase(name)) while (prev.previous != -1) prev = getPropertyStorage(prev.previous); if (prev.name.equalsIgnoreCase(name)) while (next.next != -1) next = getPropertyStorage(next.next); if (next.name.equalsIgnoreCase(name)) return findPropertyStorage(name, child);
/** * Gets the property set. Invoked when copying worksheets with macros. * Simply calls the private counterpart * * @param ps the property set name * @return the property set with the given name */ public PropertyStorage getPropertySet(int index) { return getPropertyStorage(index); } }
/** * Recursively searches the property storages in hierarchy order * for the appropriate name. This is the public version which is * invoked from the writable version * when copying a sheet with addition property sets. */ public PropertyStorage findPropertyStorage(String name) { return findPropertyStorage(name, rootEntryPropertyStorage); }