|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.util.CharacterUtils
public abstract class CharacterUtils
CharacterUtils
provides a unified interface to Character-related
operations to implement backwards compatible character operations based on a
Version
instance.
Nested Class Summary | |
---|---|
static class |
CharacterUtils.CharacterBuffer
A simple IO buffer to use with fill(CharacterBuffer, Reader) . |
Constructor Summary | |
---|---|
CharacterUtils()
|
Method Summary | |
---|---|
abstract int |
codePointAt(char[] chars,
int offset)
Returns the code point at the given index of the char array. |
abstract 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. |
abstract int |
codePointAt(CharSequence seq,
int offset)
Returns the code point at the given index of the CharSequence . |
abstract boolean |
fill(CharacterUtils.CharacterBuffer buffer,
Reader reader)
Fills the CharacterUtils.CharacterBuffer with characters read from the given
reader Reader . |
static CharacterUtils |
getInstance(Version matchVersion)
Returns a CharacterUtils implementation according to the given
Version instance. |
static CharacterUtils.CharacterBuffer |
newCharacterBuffer(int bufferSize)
Creates a new CharacterUtils.CharacterBuffer and allocates a char[]
of the given bufferSize. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CharacterUtils()
Method Detail |
---|
public static CharacterUtils getInstance(Version matchVersion)
CharacterUtils
implementation according to the given
Version
instance.
matchVersion
- a version instance
CharacterUtils
implementation according to the given
Version
instance.public abstract int codePointAt(char[] chars, int offset)
Version
passed to
getInstance(Version)
this method mimics the behavior
of Character.codePointAt(char[], int)
as it would have been
available on a Java 1.4 JVM or on a later virtual machine version.
chars
- a character arrayoffset
- the offset to the char values in the chars array to be converted
NullPointerException
- - if the array is null.
IndexOutOfBoundsException
- - if the value offset is negative or not less than the length of
the char array.public abstract int codePointAt(CharSequence seq, int offset)
CharSequence
.
Depending on the Version
passed to
getInstance(Version)
this method mimics the behavior
of Character.codePointAt(char[], int)
as it would have been
available on a Java 1.4 JVM or on a later virtual machine version.
seq
- a character sequenceoffset
- the offset to the char values in the chars array to be converted
NullPointerException
- - if the sequence is null.
IndexOutOfBoundsException
- - if the value offset is negative or not less than the length of
the character sequence.public abstract int codePointAt(char[] chars, int offset, int limit)
Version
passed to
getInstance(Version)
this method mimics the behavior
of Character.codePointAt(char[], int)
as it would have been
available on a Java 1.4 JVM or on a later virtual machine version.
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.
NullPointerException
- - if the array is null.
IndexOutOfBoundsException
- - if the value offset is negative or not less than the length of
the char array.public static CharacterUtils.CharacterBuffer newCharacterBuffer(int bufferSize)
CharacterUtils.CharacterBuffer
and allocates a char[]
of the given bufferSize.
bufferSize
- the internal char buffer size, must be >= 2
CharacterUtils.CharacterBuffer
instance.public abstract boolean fill(CharacterUtils.CharacterBuffer buffer, Reader reader) throws IOException
CharacterUtils.CharacterBuffer
with characters read from the given
reader Reader
. This method tries to read as many characters into
the CharacterUtils.CharacterBuffer
as possible, each call to fill will start
filling the buffer from offset 0
up to the length of the size
of the internal character array.
Depending on the Version
passed to
getInstance(Version)
this method implements
supplementary character awareness when filling the given buffer. For all
Version
> 3.0 fill(CharacterBuffer, Reader)
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.
buffer
- the buffer to fill.reader
- the reader to read characters from.
true
if and only if no more characters are available
in the reader, otherwise false
.
IOException
- if the reader throws an IOException
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |