private static final class CharacterUtils.Java5CharacterUtils extends CharacterUtils
CharacterUtils.CharacterBuffer
Constructor and Description |
---|
Java5CharacterUtils() |
Modifier and Type | Method and Description |
---|---|
int |
codePointAt(char[] chars,
int offset,
int limit)
Returns the code point at the given index of the char array where only elements
with index less than the limit are used.
|
int |
codePointAt(java.lang.CharSequence seq,
int offset)
Returns the code point at the given index of the
CharSequence . |
int |
codePointCount(java.lang.CharSequence seq)
Return the number of characters in
seq . |
boolean |
fill(CharacterUtils.CharacterBuffer buffer,
java.io.Reader reader,
int numChars)
Fills the
CharacterUtils.CharacterBuffer with characters read from the given
reader Reader . |
int |
offsetByCodePoints(char[] buf,
int start,
int count,
int index,
int offset)
Return the index within
buf[start:start+count] which is by offset
code points from index . |
fill, getInstance, getJava4Instance, newCharacterBuffer, readFully, toChars, toCodePoints, toLowerCase, toUpperCase
public int codePointAt(java.lang.CharSequence seq, int offset)
CharacterUtils
CharSequence
.codePointAt
in class CharacterUtils
seq
- a character sequenceoffset
- the offset to the char values in the chars array to be convertedpublic int codePointAt(char[] chars, int offset, int limit)
CharacterUtils
codePointAt
in class CharacterUtils
chars
- a character arrayoffset
- the offset to the char values in the chars array to be convertedlimit
- the index afer the last element that should be used to calculate
codepoint.public boolean fill(CharacterUtils.CharacterBuffer buffer, java.io.Reader reader, int numChars) throws java.io.IOException
CharacterUtils
CharacterUtils.CharacterBuffer
with characters read from the given
reader Reader
. This method tries to read numChars
characters into the CharacterUtils.CharacterBuffer
, each call to fill will start
filling the buffer from offset 0
up to numChars
.
In case code points can span across 2 java characters, this method may
only fill numChars - 1
characters in order not to split in
the middle of a surrogate pair, even if there are remaining characters in
the Reader
.
This method guarantees
that the given CharacterUtils.CharacterBuffer
will never contain a high surrogate
character as the last element in the buffer unless it is the last available
character in the reader. In other words, high and low surrogate pairs will
always be preserved across buffer boarders.
A return value of false
means that this method call exhausted
the reader, but there may be some bytes which have been read, which can be
verified by checking whether buffer.getLength() > 0
.
fill
in class CharacterUtils
buffer
- the buffer to fill.reader
- the reader to read characters from.numChars
- the number of chars to readfalse
if and only if reader.read returned -1 while trying to fill the bufferjava.io.IOException
- if the reader throws an IOException
.public int codePointCount(java.lang.CharSequence seq)
CharacterUtils
seq
.codePointCount
in class CharacterUtils
public int offsetByCodePoints(char[] buf, int start, int count, int index, int offset)
CharacterUtils
buf[start:start+count]
which is by offset
code points from index
.offsetByCodePoints
in class CharacterUtils