Java Code Examples for org.apache.poi.poifs.common.POIFSConstants#SMALLER_BIG_BLOCK_SIZE
The following examples show how to use
org.apache.poi.poifs.common.POIFSConstants#SMALLER_BIG_BLOCK_SIZE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OPOIFSDocument.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Constructor from large blocks * * @param name the name of the POIFSDocument * @param blocks the big blocks making up the POIFSDocument * @param length the actual length of the POIFSDocument */ public OPOIFSDocument(String name, RawDataBlock[] blocks, int length) throws IOException { _size = length; if(blocks.length == 0) { _bigBigBlockSize = POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS; } else { _bigBigBlockSize = (blocks[0].getBigBlockSize() == POIFSConstants.SMALLER_BIG_BLOCK_SIZE ? POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS : POIFSConstants.LARGER_BIG_BLOCK_SIZE_DETAILS ); } _big_store = new BigBlockStore(_bigBigBlockSize, convertRawBlocksToBigBlocks(blocks)); _property = new DocumentProperty(name, _size); _small_store = new SmallBlockStore(_bigBigBlockSize, EMPTY_SMALL_BLOCK_ARRAY); _property.setDocument(this); }
Example 2
Source File: HeaderBlock.java From lams with GNU General Public License v2.0 | 6 votes |
/** * 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 { // Update the counts and start positions new IntegerField(_bat_count_offset, _bat_count, _data); new IntegerField(_property_start_offset, _property_start, _data); new IntegerField(_sbat_start_offset, _sbat_start, _data); new IntegerField(_sbat_block_count_offset, _sbat_count, _data); new IntegerField(_xbat_start_offset, _xbat_start, _data); new IntegerField(_xbat_count_offset, _xbat_count, _data); // Write the main data out stream.write(_data, 0, 512); // Now do the padding if needed for(int i=POIFSConstants.SMALLER_BIG_BLOCK_SIZE; i<bigBlockSize.getBigBlockSize(); i++) { stream.write(0); } }
Example 3
Source File: HeaderBlock.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Create a single instance initialized with default values */ public HeaderBlock(POIFSBigBlockSize bigBlockSize) { this.bigBlockSize = bigBlockSize; // Our data is always 512 big no matter what _data = new byte[ POIFSConstants.SMALLER_BIG_BLOCK_SIZE ]; Arrays.fill(_data, _default_value); // Set all the default values new LongField(_signature_offset, _signature, _data); new IntegerField(0x08, 0, _data); new IntegerField(0x0c, 0, _data); new IntegerField(0x10, 0, _data); new IntegerField(0x14, 0, _data); new ShortField(0x18, ( short ) 0x3b, _data); new ShortField(0x1a, ( short ) 0x3, _data); new ShortField(0x1c, ( short ) -2, _data); new ShortField(0x1e, bigBlockSize.getHeaderValue(), _data); new IntegerField(0x20, 0x6, _data); new IntegerField(0x24, 0, _data); new IntegerField(0x28, 0, _data); new IntegerField(0x34, 0, _data); new IntegerField(0x38, 0x1000, _data); // Initialize the variables _bat_count = 0; _sbat_count = 0; _xbat_count = 0; _property_start = POIFSConstants.END_OF_CHAIN; _sbat_start = POIFSConstants.END_OF_CHAIN; _xbat_start = POIFSConstants.END_OF_CHAIN; }
Example 4
Source File: DocumentBlock.java From lams with GNU General Public License v2.0 | 5 votes |
/** * create a document block from a raw data block * * @param block the raw data block * * @exception IOException */ public DocumentBlock(final RawDataBlock block) throws IOException { super( block.getBigBlockSize() == POIFSConstants.SMALLER_BIG_BLOCK_SIZE ? POIFSConstants.SMALLER_BIG_BLOCK_SIZE_DETAILS : POIFSConstants.LARGER_BIG_BLOCK_SIZE_DETAILS ); _data = block.getData(); _bytes_read = _data.length; }
Example 5
Source File: RawDataBlock.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Constructor RawDataBlock * * @param stream the InputStream from which the data will be read * * @exception IOException on I/O errors, and if an insufficient * amount of data is read (the InputStream must * be an exact multiple of the block size) */ public RawDataBlock(final InputStream stream) throws IOException { this(stream, POIFSConstants.SMALLER_BIG_BLOCK_SIZE); }