@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
(返回表中的最后一个索引 <= bytePos)
|
int |
lookIndexForward(int startBytePos)
Return first index >= bytePos that is in table
(返回表中的第一个索引 >= bytePos)
|
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 into
(listIndex - 插入了字符的 TextPiece)
length
- The number of characters inserted
(length - 插入的字符数)
public boolean equals(java.lang.Object o)
equals
in class
java.lang.Object
public int getByteIndex(int charPos)
CharIndexTranslator
getByteIndex
in interface
CharIndexTranslator
(接口 CharIndexTranslator 中的 getByteIndex)
charPos
- The char position
(charPos - 字符位置)
@Deprecated public int getCharIndex(int bytePos)
@Deprecated public int getCharIndex(int startBytePos, int startCP)
public int[][] getCharIndexRanges(int startBytePosInclusive, int endBytePosExclusive)
CharIndexTranslator
getCharIndexRanges
in interface
CharIndexTranslator
(接口 CharIndexTranslator 中的 getCharIndexRanges)
startBytePosInclusive
- start byte range
(startBytePosInclusive - 起始字节范围)
endBytePosExclusive
- end byte range
(endBytePosExclusive - 结束字节范围)
protected 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.Object
public boolean isIndexInTable(int bytePos)
CharIndexTranslator
isIndexInTable
in interface
CharIndexTranslator
(接口 CharIndexTranslator 中的 isIndexInTable)
public int lookIndexBackward(int startBytePos)
CharIndexTranslator
lookIndexBackward
in interface
CharIndexTranslator
(接口 CharIndexTranslator 中的lookIndexBackward)
public int lookIndexForward(int startBytePos)
CharIndexTranslator
lookIndexForward
in interface
CharIndexTranslator
(接口 CharIndexTranslator 中的lookIndexForward)
public byte[] writeTo(java.io.ByteArrayOutputStream docStream) throws java.io.IOException
java.io.IOException
(java.io.IOException)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.