|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.text.BreakIterator
public abstract class BreakIterator
This class is used to locate the boundaries of text. Instance of this class can be got by some factory methods:
getCharacterInstance() returns a BreakIterator that iterate the
logical characters without worrying about how the character is stored. For
example, some character may be stored in more than one Unicode code point
according to Unicode specification, this character can handle the logical
characters with multi code points.getWordInstance() returns a BreakIterator that
iterate the word-breaks. The beginning and end of each word(including numbers)
is treated as boundary position. Whitespace and punctuation are kept separate
from real words.getSentenceInstance() returns a BreakIterator that iterate the
sentence-breaks.getLineInstance() returns a BreakIterator that iterate the
line-breaks which can be used to wrap lines. This iterator can handle whitespaces,
hyphens and punctuations.
BreakIterator uses CharacterIterator to perform the
analysis, so that any storage which provides CharacterIterator
interface.
CharacterIterator| Field Summary | |
|---|---|
static int |
DONE
This constant is returned by iterate methods like previous() or next() if they have returned all valid boundaries. |
(package private) com.ibm.icu4jni.text.BreakIterator |
wrapped
|
| Constructor Summary | |
|---|---|
protected |
BreakIterator()
Default constructor, just for invocation by subclass. |
(package private) |
BreakIterator(com.ibm.icu4jni.text.BreakIterator iterator)
|
| Method Summary | |
|---|---|
Object |
clone()
Create copy of this iterator, all status including current position is kept. |
abstract int |
current()
Return this iterator's current position. |
abstract int |
first()
Set this iterator's current position to the first boundary, and return this position. |
abstract int |
following(int offset)
Set the position of the first boundary following the given offset, and return this position. |
static Locale[] |
getAvailableLocales()
Return all supported locales. |
static BreakIterator |
getCharacterInstance()
Return a new instance of BreakIterator used to iterate characters using default locale. |
static BreakIterator |
getCharacterInstance(Locale where)
Return a new instance of BreakIterator used to iterate characters using given locale. |
protected static int |
getInt(byte[] buf,
int offset)
Get an int value from the given byte array, start from given offset. |
static BreakIterator |
getLineInstance()
Return a new instance of BreakIterator used to iterate line-breaks using default locale. |
static BreakIterator |
getLineInstance(Locale where)
Return a new instance of BreakIterator used to iterate line-breaks using given locale. |
protected static long |
getLong(byte[] buf,
int offset)
Get a long value from the given byte array, start from given offset. |
static BreakIterator |
getSentenceInstance()
Return a new instance of BreakIterator used to iterate sentence-breaks using default locale. |
static BreakIterator |
getSentenceInstance(Locale where)
Return a new instance of BreakIterator used to iterate sentence-breaks using given locale. |
protected static short |
getShort(byte[] buf,
int offset)
Get a short value from the given byte array, start from given offset. |
abstract CharacterIterator |
getText()
Return a CharacterIterator which represents the text being
analyzed. |
static BreakIterator |
getWordInstance()
Return a new instance of BreakIterator used to iterate word-breaks using default locale. |
static BreakIterator |
getWordInstance(Locale where)
Return a new instance of BreakIterator used to iterate word-breaks using given locale. |
boolean |
isBoundary(int offset)
Return true if the given offset is a boundary position. |
abstract int |
last()
Set this iterator's current position to the last boundary, and return this position. |
abstract int |
next()
Set this iterator's current position to the next boundary after current position, and return this position. |
abstract int |
next(int n)
Set this iterator's current position to the next boundary after the given position, and return this position. |
int |
preceding(int offset)
Return the position of last boundary precede the given offset, and set current position to returned value, or DONE if the given
offset specifies the starting position. |
abstract int |
previous()
Set this iterator's current position to the previous boundary before current position, and return this position. |
abstract void |
setText(CharacterIterator newText)
Set new text to be analyzed by given CharacterIterator. |
void |
setText(String newText)
Set the new text string to be analyzed, the current position will be reset to beginning of this new string, and the old string will lost. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DONE
com.ibm.icu4jni.text.BreakIterator wrapped
| Constructor Detail |
|---|
protected BreakIterator()
BreakIterator(com.ibm.icu4jni.text.BreakIterator iterator)
| Method Detail |
|---|
public static Locale[] getAvailableLocales()
public static BreakIterator getCharacterInstance()
public static BreakIterator getCharacterInstance(Locale where)
where - the given locale
public static BreakIterator getLineInstance()
public static BreakIterator getLineInstance(Locale where)
where - the given locale
public static BreakIterator getSentenceInstance()
public static BreakIterator getSentenceInstance(Locale where)
where - the given locale
public static BreakIterator getWordInstance()
public static BreakIterator getWordInstance(Locale where)
where - the given locale
public boolean isBoundary(int offset)
offset - the given offset to check
public int preceding(int offset)
DONE if the given
offset specifies the starting position.
IllegalArgumentException will be thrown if given offset is
invalid.
offset - the given start position to be searched for
public void setText(String newText)
newText - the new text string to be analyzedpublic abstract int current()
public abstract int first()
public abstract int following(int offset)
IllegalArgumentException will be thrown if given offset is
invalid.
offset - the given position to be searched for
public abstract CharacterIterator getText()
CharacterIterator which represents the text being
analyzed. Please note that the returned value is probably the internal
iterator used by this object, so that if the invoker want to modify the
status of the returned iterator, a clone operation at first is
recommended.
CharacterIterator which represents the text
being analyzed.public abstract int last()
public abstract int next()
DONE if no
boundary found after current position.
public abstract int next(int n)
DONE if no
boundary found after the given position.
n - the given position.
public abstract int previous()
DONE if
no boundary found before current position.
public abstract void setText(CharacterIterator newText)
CharacterIterator.
The position will be reset to the beginning of the new text, and other
status of this iterator will be kept.
newText - the given CharacterIterator refer to the text
to be analyzedpublic Object clone()
clone in class Object
protected static long getLong(byte[] buf,
int offset)
buf - the bytes to be convertedoffset - the start position of conversion
protected static int getInt(byte[] buf,
int offset)
buf - the bytes to be convertedoffset - the start position of conversion
protected static short getShort(byte[] buf,
int offset)
buf - the bytes to be convertedoffset - the start position of conversion
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||