public final class UTF16Buffer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private char[] |
buffer
The backing store of the buffer.
|
private int |
end
The index of the slot immediately after the last character in the backing
buffer that is part of the logical content of this
UTF16Buffer . |
private int |
start
The index of the first unconsumed character in the backing buffer.
|
Constructor and Description |
---|
UTF16Buffer(char[] buffer,
int start,
int end)
Constructor for wrapping an existing UTF-16 code unit array.
|
Modifier and Type | Method and Description |
---|---|
void |
adjust(boolean lastWasCR)
Adjusts the start index to skip over the first character if it is a line
feed and the previous character was a carriage return.
|
char[] |
getBuffer()
Returns the backing buffer.
|
int |
getEnd()
Returns the end index.
|
int |
getStart()
Returns the start index.
|
boolean |
hasMore()
Checks if the buffer has data left.
|
void |
setEnd(int end)
Sets the end index.
|
void |
setStart(int start)
Sets the start index.
|
private final char[] buffer
UTF16Buffer
.private int start
private int end
UTF16Buffer
.public UTF16Buffer(char[] buffer, int start, int end)
buffer
- the backing bufferstart
- the index of the first character to consumeend
- the index immediately after the last character to consumepublic int getStart()
public void setStart(int start)
start
- the start indexpublic char[] getBuffer()
public int getEnd()
public boolean hasMore()
true
if there's data leftpublic void adjust(boolean lastWasCR)
lastWasCR
- whether the previous character was a carriage returnpublic void setEnd(int end)
end
- the end index