Example usage for org.apache.poi.poifs.common POIFSConstants SMALLER_BIG_BLOCK_SIZE

List of usage examples for org.apache.poi.poifs.common POIFSConstants SMALLER_BIG_BLOCK_SIZE

Introduction

In this page you can find the example usage for org.apache.poi.poifs.common POIFSConstants SMALLER_BIG_BLOCK_SIZE.

Prototype

int SMALLER_BIG_BLOCK_SIZE

To view the source code for org.apache.poi.poifs.common POIFSConstants SMALLER_BIG_BLOCK_SIZE.

Click Source Link

Document

Most files use 512 bytes as their big block size

Usage

From source file:org.textmining.extraction.word.chp.Word6CHPBinTable.java

License:Open Source License

/**
 * Constructor used to read a binTable in from a Word document.
 *
 * @param documentStream The POIFS "WordDocument" stream from a Word document
 * @param offset The offset of the Chp bin table in the main stream.
 * @param size The size of the Chp bin table in the main stream.
 * @param fcMin The start of text in the main stream.
 *//*w w w .j a  v a 2  s  .  c  o m*/
public Word6CHPBinTable(byte[] documentStream, int offset, int size, int fcMin, NodeHelper helper) {
    PlexOfCps binTable = new PlexOfCps(documentStream, offset, size, 2);

    int length = binTable.length();
    for (int x = 0; x < length; x++) {
        GenericPropertyNode node = binTable.getProperty(x);

        int pageNum = LittleEndian.getShort((byte[]) node.getBytes());
        int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;

        //TODO fix this
        CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream, pageOffset, fcMin, helper);

        int fkpSize = cfkp.size();

        for (int y = 0; y < fkpSize; y++) {
            _textRuns.add(cfkp.getCHPX(y));
        }
    }
    helper.sortNodes(_textRuns, false);
}

From source file:org.textmining.extraction.word.model.CHPBinTable.java

License:Open Source License

/**
 * Constructor used to read a binTable in from a Word document.
 * @param documentStream//w  w  w .  ja v  a  2  s .  c om
 * @param tableStream
 * @param offset
 * @param size
 * @param fcMin
 * @param fc2Cp TODO
 * @param textPieces TODO
 */
public CHPBinTable(byte[] documentStream, byte[] tableStream, int offset, int size, int fcMin,
        NodeHelper fc2Cp) {
    PlexOfCps binTable = new PlexOfCps(tableStream, offset, size, 4);

    int length = binTable.length();
    for (int x = 0; x < length; x++) {
        GenericPropertyNode node = binTable.getProperty(x);

        int pageNum = LittleEndian.getInt(node.getBytes());
        int pageOffset = POIFSConstants.SMALLER_BIG_BLOCK_SIZE * pageNum;

        CHPFormattedDiskPage cfkp = new CHPFormattedDiskPage(documentStream, pageOffset, fcMin, fc2Cp);

        int fkpSize = cfkp.size();

        for (int y = 0; y < fkpSize; y++) {
            _textRuns.add(cfkp.getCHPX(y));
        }
    }
    fc2Cp.sortNodes(_textRuns, false);
}