/** * Writes the block chains for the additional property sets * * @exception IOException */ private void writeAdditionalPropertySetBlockChains() throws IOException { if (additionalPropertySets == null) { return; } int blockNumber = excelDataStartBlock + excelDataBlocks + 16; for (Iterator i = additionalPropertySets.iterator(); i.hasNext() ; ) { ReadPropertyStorage rps = (ReadPropertyStorage) i.next(); if (rps.data.length > SMALL_BLOCK_THRESHOLD) { int numBlocks = getBigBlocksRequired(rps.data.length); writeBlockChain(blockNumber, numBlocks); blockNumber += numBlocks; } } }
/** * Writes out all the data in the small block depot * * @exception */ private void writeSmallBlockDepot() throws IOException { if (additionalPropertySets == null) { return; } byte[] smallBlockDepot = new byte[numSmallBlockDepotBlocks * BIG_BLOCK_SIZE]; int pos = 0; for (Iterator i = additionalPropertySets.iterator() ; i.hasNext() ; ) { ReadPropertyStorage rps = (ReadPropertyStorage) i.next(); if (rps.data.length <= SMALL_BLOCK_THRESHOLD) { int smallBlocks = getSmallBlocksRequired(rps.data.length); int length = smallBlocks * SMALL_BLOCK_SIZE; System.arraycopy(rps.data, 0, smallBlockDepot, pos, rps.data.length); pos += length; } } out.write(smallBlockDepot); }
/** * Writes out the excel file in OLE compound file format * * @exception IOException */ public void write() throws IOException { writeHeader(); writeExcelData(); writeDocumentSummaryData(); writeSummaryData(); writeAdditionalPropertySets(); writeSmallBlockDepot(); writeSmallBlockDepotChain(); writeBigBlockDepot(); writePropertySets(); // Don't flush or close the stream - this is handled by the enclosing File // object }
checkBbdPos(); writeBlockChain(excelDataStartBlock, excelDataBlocks); checkBbdPos(); checkBbdPos(); checkBbdPos(); checkBbdPos(); writeAdditionalPropertySetBlockChains(); writeBlockChain(sbdStartBlock, numSmallBlockDepotBlocks); writeBlockChain(sbdStartBlockChain, numSmallBlockDepotChainBlocks); checkBbdPos(); writeBlockChain(rootStartBlock, numRootEntryBlocks);
int blocks = getBigBlocksRequired(data.length); blocksRequired += blocks; int blocks = getSmallBlocksRequired(data.length); numSmallBlocks += blocks;
/** * Closes the file. In fact, this writes out all the excel data * to disk using a CompoundFile object, and then frees up all the memory * allocated to the workbook * * @exception IOException * @param cs TRUE if this should close the stream, FALSE if the application * closes it */ void close(boolean cs) throws IOException, JxlWriteException { CompoundFile cf = new CompoundFile(data, data.getPosition(), outputStream, readCompoundFile); cf.write(); outputStream.flush(); data.close(); if (cs) { outputStream.close(); } // Cleanup the memory a bit data = null; if (!workbookSettings.getGCDisabled()) { System.gc(); } }
excelData = data; readAdditionalPropertySets(rcf); numSmallBlockDepotChainBlocks = getBigBlocksRequired(numSmallBlocks * 4); numSmallBlockDepotBlocks = getBigBlocksRequired (numSmallBlocks * SMALL_BLOCK_SIZE); numRootEntryBlocks += getBigBlocksRequired (additionalPropertySets.size() * PROPERTY_STORAGE_BLOCK_SIZE); int blocks = getBigBlocksRequired(l);
/** * Writes out any additional property sets */ private void writeAdditionalPropertySets() throws IOException { if (additionalPropertySets == null) { return; } for (Iterator i = additionalPropertySets.iterator(); i.hasNext() ;) { ReadPropertyStorage rps = (ReadPropertyStorage) i.next(); byte[] data = rps.data; if (data.length > SMALL_BLOCK_THRESHOLD) { int numBlocks = getBigBlocksRequired(data.length); int requiredSize = numBlocks * BIG_BLOCK_SIZE; out.write(data, 0, data.length); byte[] padding = new byte[requiredSize - data.length]; out.write(padding, 0, padding.length); } } }
checkBbdPos(); writeBlockChain(excelDataStartBlock, excelDataBlocks); checkBbdPos(); checkBbdPos(); checkBbdPos(); checkBbdPos(); writeAdditionalPropertySetBlockChains(); writeBlockChain(sbdStartBlock, numSmallBlockDepotBlocks); writeBlockChain(sbdStartBlockChain, numSmallBlockDepotChainBlocks); checkBbdPos(); writeBlockChain(rootStartBlock, numRootEntryBlocks);
int blocks = getBigBlocksRequired(data.length); blocksRequired += blocks; int blocks = getSmallBlocksRequired(data.length); numSmallBlocks += blocks;
/** * Closes the file. In fact, this writes out all the excel data * to disk using a CompoundFile object, and then frees up all the memory * allocated to the workbook * * @exception IOException * @param cs TRUE if this should close the stream, FALSE if the application * closes it */ void close(boolean cs) throws IOException, JxlWriteException { CompoundFile cf = new CompoundFile(data, data.getPosition(), outputStream, readCompoundFile); cf.write(); outputStream.flush(); data.close(); if (cs) { outputStream.close(); } // Cleanup the memory a bit data = null; if (!workbookSettings.getGCDisabled()) { System.gc(); } }
excelData = data; readAdditionalPropertySets(rcf); numSmallBlockDepotChainBlocks = getBigBlocksRequired(numSmallBlocks * 4); numSmallBlockDepotBlocks = getBigBlocksRequired (numSmallBlocks * SMALL_BLOCK_SIZE); numRootEntryBlocks += getBigBlocksRequired (additionalPropertySets.size() * PROPERTY_STORAGE_BLOCK_SIZE); int blocks = getBigBlocksRequired(l);
/** * Writes out any additional property sets */ private void writeAdditionalPropertySets() throws IOException { if (additionalPropertySets == null) { return; } for (Iterator i = additionalPropertySets.iterator(); i.hasNext() ;) { ReadPropertyStorage rps = (ReadPropertyStorage) i.next(); byte[] data = rps.data; if (data.length > SMALL_BLOCK_THRESHOLD) { int numBlocks = getBigBlocksRequired(data.length); int requiredSize = numBlocks * BIG_BLOCK_SIZE; out.write(data, 0, data.length); byte[] padding = new byte[requiredSize - data.length]; out.write(padding, 0, padding.length); } } }
/** * Writes out the excel file in OLE compound file format * * @exception IOException */ public void write() throws IOException { writeHeader(); writeExcelData(); writeDocumentSummaryData(); writeSummaryData(); writeAdditionalPropertySets(); writeSmallBlockDepot(); writeSmallBlockDepotChain(); writeBigBlockDepot(); writePropertySets(); // Don't flush or close the stream - this is handled by the enclosing File // object }
size += getBigBlocksRequired(requiredSize) * BIG_BLOCK_SIZE; size += getBigBlocksRequired(SMALL_BLOCK_THRESHOLD) * BIG_BLOCK_SIZE; size += getBigBlocksRequired(SMALL_BLOCK_THRESHOLD) * BIG_BLOCK_SIZE; size += getBigBlocksRequired(rps.propertyStorage.size) * BIG_BLOCK_SIZE; size += getSmallBlocksRequired(rps.propertyStorage.size) * SMALL_BLOCK_SIZE; bigBlock += getBigBlocksRequired(rps.data.length); smallBlock += getSmallBlocksRequired(rps.data.length);
/** * Writes the block chains for the additional property sets * * @exception IOException */ private void writeAdditionalPropertySetBlockChains() throws IOException { if (additionalPropertySets == null) { return; } int blockNumber = excelDataStartBlock + excelDataBlocks + 16; for (Iterator i = additionalPropertySets.iterator(); i.hasNext() ; ) { ReadPropertyStorage rps = (ReadPropertyStorage) i.next(); if (rps.data.length > SMALL_BLOCK_THRESHOLD) { int numBlocks = getBigBlocksRequired(rps.data.length); writeBlockChain(blockNumber, numBlocks); blockNumber += numBlocks; } } }
/** * Writes out all the data in the small block depot * * @exception */ private void writeSmallBlockDepot() throws IOException { if (additionalPropertySets == null) { return; } byte[] smallBlockDepot = new byte[numSmallBlockDepotBlocks * BIG_BLOCK_SIZE]; int pos = 0; for (Iterator i = additionalPropertySets.iterator() ; i.hasNext() ; ) { ReadPropertyStorage rps = (ReadPropertyStorage) i.next(); if (rps.data.length <= SMALL_BLOCK_THRESHOLD) { int smallBlocks = getSmallBlocksRequired(rps.data.length); int length = smallBlocks * SMALL_BLOCK_SIZE; System.arraycopy(rps.data, 0, smallBlockDepot, pos, rps.data.length); pos += length; } } out.write(smallBlockDepot); }
size += getBigBlocksRequired(requiredSize) * BIG_BLOCK_SIZE; size += getBigBlocksRequired(SMALL_BLOCK_THRESHOLD) * BIG_BLOCK_SIZE; size += getBigBlocksRequired(SMALL_BLOCK_THRESHOLD) * BIG_BLOCK_SIZE; size += getBigBlocksRequired(rps.propertyStorage.size) * BIG_BLOCK_SIZE; size += getSmallBlocksRequired(rps.propertyStorage.size) * SMALL_BLOCK_SIZE; bigBlock += getBigBlocksRequired(rps.data.length); smallBlock += getSmallBlocksRequired(rps.data.length);