Package org.apache.poi.hwpf.model
Interface CharIndexTranslator
- All Known Implementing Classes:
OldTextPieceTable,TextPieceTable
-
Method Summary
Modifier and TypeMethodDescriptionintgetByteIndex(int charPos) Calculates the byte index of the given char index.int[][]getCharIndexRanges(int startBytePosInclusive, int endBytePosExclusive) Finds character ranges that includes specified byte range.booleanisIndexInTable(int bytePos) Check if index is in tableintlookIndexBackward(int bytePos) Return last index <= bytePos that is in tableintlookIndexForward(int bytePos) Return first index >= bytePos that is in table
-
Method Details
-
getByteIndex
int getByteIndex(int charPos) Calculates the byte index of the given char index.- Parameters:
charPos- The char position- Returns:
- The byte index
-
getCharIndexRanges
int[][] getCharIndexRanges(int startBytePosInclusive, int endBytePosExclusive) Finds character ranges that includes specified byte range.- Parameters:
startBytePosInclusive- start byte rangeendBytePosExclusive- 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
-