Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.hwpf.model
Class TextPieceTable

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

All Implemented Interfaces:
  CharIndexTranslator

    public class TextPieceTable

extends java.lang.Object
implements CharIndexTranslator

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

Constructor Summary
`TextPieceTable()`
`TextPieceTable(byte[] documentStream, byte[] tableStream, int offset, int size, int fcMin)`

Method Summary
`void` | `add(TextPiece piece)`
`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` | `getCharIndex(int bytePos)` Calculates the char index of the given byte index.
`int` | `getCharIndex(int bytePos, int startCP)` Calculates the char index of the given byte index.
`int` | `getCpMin()`
`java.util.List` | `getTextPieces()`
`boolean` | `isIndexInTable(int bytePos)` Check if index is in table
`int` | `lookIndexBackward(int bytePos)` Return last index <= bytePos that is in table
`int` | `lookIndexForward(int bytePos)` Return first index >= bytePos that is in table
`byte[]` | `writeTo(HWPFOutputStream docStream)`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TextPieceTable

    public TextPieceTable()

### TextPieceTable

    public TextPieceTable(byte[] documentStream,
                          byte[] tableStream,
                          int offset,
                          int size,
                          int fcMin)

Method Detail

### getCpMin

    public int getCpMin()

### getTextPieces

    public java.util.List getTextPieces()

### add

    public void add(TextPiece piece)

### 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`

### getCharIndex

    public int getCharIndex(int bytePos)

  Description copied from interface: `CharIndexTranslator`
  Calculates the char index of the given byte index. Look forward if index is not in table

  Specified by:
    `getCharIndex` in interface `CharIndexTranslator`
  Parameters:
    `bytePos` - The character offset to check
  Returns:
    the char index

### getCharIndex

    public int getCharIndex(int bytePos,
                            int startCP)

  Description copied from interface: `CharIndexTranslator`
  Calculates the char index of the given byte index. Look forward if index is not in table

  Specified by:
    `getCharIndex` in interface `CharIndexTranslator`
  Parameters:
    `bytePos` - The character offset to check
    `startCP` - look from this characted position
  Returns:
    the char index

### lookIndexForward

    public int lookIndexForward(int bytePos)

  Description copied from interface: `CharIndexTranslator`
  Return first index >= bytePos that is in table

  Specified by:
    `lookIndexForward` in interface `CharIndexTranslator`
  Returns:
    first index greater or equal to bytePos that is in table

### lookIndexBackward

    public int lookIndexBackward(int bytePos)

  Description copied from interface: `CharIndexTranslator`
  Return last index <= bytePos that is in table

  Specified by:
    `lookIndexBackward` in interface `CharIndexTranslator`
  Returns:
    last index less of equal to bytePos that is in table

### isIndexInTable

    public boolean isIndexInTable(int bytePos)

  Description copied from interface: `CharIndexTranslator`
  Check if index is in table

  Specified by:
    `isIndexInTable` in interface `CharIndexTranslator`
  Returns:
    true if index in table, false if not

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD