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)
          Deprecated. This API were based on incorrect assumption that single byte offset corresponds to single char offset
 int getCharIndex(int bytePos, int startCP)
          Deprecated. This API were based on incorrect assumption that single byte offset corresponds to single char offset
 int[][] getCharIndexRanges(int startBytePosInclusive, int endBytePosExclusive)
          Finds character ranges that includes specified byte range.
 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

@Deprecated
int getCharIndex(int bytePos)
Deprecated. This API were based on incorrect assumption that single byte offset corresponds to single char offset

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

@Deprecated
int getCharIndex(int bytePos,
                            int startCP)
Deprecated. This API were based on incorrect assumption that single byte offset corresponds to single char offset

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

getCharIndexRanges

int[][] getCharIndexRanges(int startBytePosInclusive,
                           int endBytePosExclusive)
Finds character ranges that includes specified byte range.

Parameters:
startBytePosInclusive - start byte range
endBytePosExclusive - end byte range

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 2012 The Apache Software Foundation or its licensors, as applicable.