org.apache.poi.hwpf.model
Interface CharIndexTranslator

All Known Implementing Classes:
TextPieceTable

@Internal
public interface CharIndexTranslator


Method Summary
 int getByteIndex(int charPos)
          Calculates the byte index of the given char index.
 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.
 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
 

Method Detail

getByteIndex

int getByteIndex(int charPos)
Calculates the byte index of the given char index.

Parameters:
charPos - The char position
Returns:
The byte index

getCharIndex

int getCharIndex(int bytePos)
Calculates the char index of the given byte index. Look forward if index is not in table

Parameters:
bytePos - The character offset to check
Returns:
the char index

getCharIndex

int getCharIndex(int bytePos,
                 int startCP)
Calculates the char index of the given byte index. Look forward if index is not in table

Parameters:
bytePos - The character offset to check
startCP - look from this characted position
Returns:
the char index

isIndexInTable

boolean isIndexInTable(int bytePos)
Check if index is in table

Parameters:
bytePos -
Returns:
true if index in table, false if not

lookIndexForward

int lookIndexForward(int bytePos)
Return first index >= bytePos that is in table

Parameters:
bytePos -
Returns:
first index greater or equal to bytePos that is in table

lookIndexBackward

int lookIndexBackward(int bytePos)
Return last index <= bytePos that is in table

Parameters:
bytePos -
Returns:
last index less of equal to bytePos that is in table


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