@Internal public class TextPieceTable extends java.lang.Object implements CharIndexTranslator
| Modifier and Type | Class and Description |
|---|---|
protected static class |
TextPieceTable.FCComparator |
| Modifier and Type | Field and Description |
|---|---|
protected java.util.ArrayList<TextPiece> |
_textPieces |
protected java.util.ArrayList<TextPiece> |
_textPiecesFCOrder |
| Constructor and Description |
|---|
TextPieceTable() |
TextPieceTable(byte[] documentStream,
byte[] tableStream,
int offset,
int size,
int fcMin) |
| Modifier and Type | Method and Description |
|---|---|
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 |
getByteIndex(int charPos)
Calculates the byte index of the given char index.
|
int |
getCharIndex(int bytePos)
Deprecated.
|
int |
getCharIndex(int startBytePos,
int startCP)
Deprecated.
|
int[][] |
getCharIndexRanges(int startBytePosInclusive,
int endBytePosExclusive)
Finds character ranges that includes specified byte range.
|
int |
getCpMin() |
protected int |
getEncodingMultiplier(TextPiece textPiece) |
java.lang.StringBuilder |
getText() |
java.util.List<TextPiece> |
getTextPieces() |
int |
hashCode() |
boolean |
isIndexInTable(int bytePos)
Check if index is in table
|
int |
lookIndexBackward(int startBytePos)
Return last index <= bytePos that is in table
|
int |
lookIndexForward(int startBytePos)
Return first index >= bytePos that is in table
|
protected TextPiece |
newTextPiece(int nodeStartChars,
int nodeEndChars,
byte[] buf,
PieceDescriptor pd) |
byte[] |
writeTo(java.io.ByteArrayOutputStream docStream) |
protected java.util.ArrayList<TextPiece> _textPieces
protected java.util.ArrayList<TextPiece> _textPiecesFCOrder
public TextPieceTable()
public TextPieceTable(byte[] documentStream,
byte[] tableStream,
int offset,
int size,
int fcMin)
protected TextPiece newTextPiece(int nodeStartChars, int nodeEndChars, byte[] buf, PieceDescriptor pd)
public void add(TextPiece piece)
public int adjustForInsert(int listIndex,
int length)
listIndex - The TextPiece that had characters inserted intolength - The number of characters insertedpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int getByteIndex(int charPos)
CharIndexTranslatorgetByteIndex in interface CharIndexTranslatorcharPos - The char position@Deprecated public int getCharIndex(int bytePos)
@Deprecated
public int getCharIndex(int startBytePos,
int startCP)
public int[][] getCharIndexRanges(int startBytePosInclusive,
int endBytePosExclusive)
CharIndexTranslatorgetCharIndexRanges in interface CharIndexTranslatorstartBytePosInclusive - start byte rangeendBytePosExclusive - end byte rangeprotected int getEncodingMultiplier(TextPiece textPiece)
public int getCpMin()
public java.lang.StringBuilder getText()
public java.util.List<TextPiece> getTextPieces()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean isIndexInTable(int bytePos)
CharIndexTranslatorisIndexInTable in interface CharIndexTranslatorpublic int lookIndexBackward(int startBytePos)
CharIndexTranslatorlookIndexBackward in interface CharIndexTranslatorpublic int lookIndexForward(int startBytePos)
CharIndexTranslatorlookIndexForward in interface CharIndexTranslatorpublic byte[] writeTo(java.io.ByteArrayOutputStream docStream)
throws java.io.IOException
java.io.IOExceptionCopyright 2018 The Apache Software Foundation or its licensors, as applicable.