org.apache.poi.hwpf.model
Class TextPieceTable

java.lang.Object
  extended by org.apache.poi.hwpf.model.TextPieceTable

public class TextPieceTable
extends java.lang.Object

The piece table for matching up character positions to bits of text. This mostly works in bytes, but the TextPieces themselves work in characters. This does the icky convertion.

Author:
Ryan Ackley

Field Summary
protected  java.util.ArrayList _textPieces
           
 
Constructor Summary
TextPieceTable()
           
TextPieceTable(byte[] documentStream, byte[] tableStream, int offset, int size, int fcMin)
           
 
Method Summary
 int adjustForInsert(int listIndex, int length)
          Adjust all the text piece after inserting some text into one of them
 boolean equals(java.lang.Object o)
           
 int getCpMin()
           
 java.util.List getTextPieces()
           
 boolean isUnicodeAtByteOffset(int bytePos)
          Is the text at the given byte offset unicode, or plain old ascii? In a very evil fashion, you have to actually know this to make sense of character and paragraph properties :(
 boolean isUnicodeAtCharOffset(int cp)
          Is the text at the given Character offset unicode, or plain old ascii? In a very evil fashion, you have to actually know this to make sense of character and paragraph properties :(
 byte[] writeTo(HWPFOutputStream docStream)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_textPieces

protected java.util.ArrayList _textPieces
Constructor Detail

TextPieceTable

public TextPieceTable()

TextPieceTable

public TextPieceTable(byte[] documentStream,
                      byte[] tableStream,
                      int offset,
                      int size,
                      int fcMin)
               throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException
Method Detail

getCpMin

public int getCpMin()

getTextPieces

public java.util.List getTextPieces()

isUnicodeAtCharOffset

public boolean isUnicodeAtCharOffset(int cp)
Is the text at the given Character offset unicode, or plain old ascii? In a very evil fashion, you have to actually know this to make sense of character and paragraph properties :(

Parameters:
cp - The character offset to check about

isUnicodeAtByteOffset

public boolean isUnicodeAtByteOffset(int bytePos)
Is the text at the given byte offset unicode, or plain old ascii? In a very evil fashion, you have to actually know this to make sense of character and paragraph properties :(

Parameters:
cp - The character offset to check about

writeTo

public byte[] writeTo(HWPFOutputStream docStream)
               throws java.io.IOException
Throws:
java.io.IOException

adjustForInsert

public int adjustForInsert(int listIndex,
                           int length)
Adjust all the text piece after inserting some text into one of them

Parameters:
listIndex - The TextPiece that had characters inserted into
length - The number of characters inserted

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright 2008 The Apache Software Foundation or its licensors, as applicable.