FileDocCategorySizeDatePackage
ComplexFileTable.javaAPI DocApache Poi 3.0.12638Mon Jan 01 18:55:34 GMT 2007org.apache.poi.hwpf.model

ComplexFileTable

public class ComplexFileTable extends Object

Fields Summary
private static final byte
GRPPRL_TYPE
private static final byte
TEXT_PIECE_TABLE_TYPE
protected TextPieceTable
_tpt
Constructors Summary
public ComplexFileTable()


   
  
    _tpt = new TextPieceTable();
  
public ComplexFileTable(byte[] documentStream, byte[] tableStream, int offset, int fcMin)

    //skips through the prms before we reach the piece table. These contain data
    //for actual fast saved files
    while (tableStream[offset] == GRPPRL_TYPE)
    {
      offset++;
      int skip = LittleEndian.getShort(tableStream, offset);
      offset += LittleEndian.SHORT_SIZE + skip;
    }
    if(tableStream[offset] != TEXT_PIECE_TABLE_TYPE)
    {
      throw new IOException("The text piece table is corrupted");
    }
    else
    {
      int pieceTableSize = LittleEndian.getInt(tableStream, ++offset);
      offset += LittleEndian.INT_SIZE;
      _tpt = new TextPieceTable(documentStream, tableStream, offset, pieceTableSize, fcMin);
    }
  
Methods Summary
public org.apache.poi.hwpf.model.TextPieceTablegetTextPieceTable()

    return _tpt;
  
public voidwriteTo(org.apache.poi.hwpf.model.io.HWPFFileSystem sys)

    HWPFOutputStream docStream = sys.getStream("WordDocument");
    HWPFOutputStream tableStream = sys.getStream("1Table");

    tableStream.write(TEXT_PIECE_TABLE_TYPE);

    byte[] table = _tpt.writeTo(docStream);

    byte[] numHolder = new byte[LittleEndian.INT_SIZE];
    LittleEndian.putInt(numHolder, table.length);
    tableStream.write(numHolder);
    tableStream.write(table);