Methods Summary |
---|
public java.lang.Object | clone()Create a copy of this iterator
try {
return super.clone();
}
catch (CloneNotSupportedException e) {
throw new InternalError();
}
|
private static java.text.BreakIterator | createBreakInstance(java.util.Locale where, int type, java.lang.String dataName, java.lang.String dictionaryName)
ResourceBundle bundle = getBundle(
"sun.text.resources.BreakIteratorInfo", where);
String[] classNames = bundle.getStringArray("BreakIteratorClasses");
String dataFile = bundle.getString(dataName);
try {
if (classNames[type].equals("RuleBasedBreakIterator")) {
return new RuleBasedBreakIterator(dataFile);
}
else if (classNames[type].equals("DictionaryBasedBreakIterator")) {
String dictionaryFile = bundle.getString(dictionaryName);
return new DictionaryBasedBreakIterator(dataFile, dictionaryFile);
}
else {
throw new IllegalArgumentException("Invalid break iterator class \"" +
classNames[type] + "\"");
}
}
catch (Exception e) {
throw new InternalError(e.toString());
}
|
public abstract int | current()Return character index of the text boundary that was most recently
returned by next(), previous(), first(), or last()
|
public abstract int | first()Return the first boundary. The iterator's current position is set
to the first boundary.
|
public abstract int | following(int offset)Return the first boundary following the specified offset.
The value returned is always greater than the offset or
the value BreakIterator.DONE
|
public static synchronized java.util.Locale[] | getAvailableLocales()Returns an array of all locales for which the
get*Instance methods of this class can return
localized instances.
The array returned must contain at least a Locale
instance equal to {@link java.util.Locale#US Locale.US}.
//FIX ME - this is a known bug. It should return
//all locales.
return LocaleData.getAvailableLocales("NumberPatterns");
|
private static java.text.BreakIterator | getBreakInstance(java.util.Locale where, int type, java.lang.String dataName, java.lang.String dictionaryName)
if (iterCache[type] != null) {
BreakIteratorCache cache = (BreakIteratorCache) iterCache[type].get();
if (cache != null) {
if (cache.getLocale().equals(where)) {
return cache.createBreakInstance();
}
}
}
BreakIterator result = createBreakInstance(where,
type,
dataName,
dictionaryName);
BreakIteratorCache cache = new BreakIteratorCache(where, result);
iterCache[type] = new SoftReference(cache);
return result;
|
private static java.util.ResourceBundle | getBundle(java.lang.String baseName, java.util.Locale locale)
return (ResourceBundle) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return ResourceBundle.getBundle(baseName, locale);
}
});
|
public static java.text.BreakIterator | getCharacterInstance()Create BreakIterator for character-breaks using default locale
Returns an instance of a BreakIterator implementing character breaks.
Character breaks are boundaries of combining character sequences.
return getCharacterInstance(Locale.getDefault());
|
public static java.text.BreakIterator | getCharacterInstance(java.util.Locale where)Create BreakIterator for character-breaks using specified locale
Returns an instance of a BreakIterator implementing character breaks.
Character breaks are boundaries of combining character sequences.
return getBreakInstance(where,
CHARACTER_INDEX,
"CharacterData",
"CharacterDictionary");
|
protected static int | getInt(byte[] buf, int offset)
int num = buf[offset]&0xFF;
for (int i = 1; i < 4; i++) {
num = num<<8 | (buf[offset+i]&0xFF);
}
return num;
|
public static java.text.BreakIterator | getLineInstance()Create BreakIterator for line-breaks using default locale.
Returns an instance of a BreakIterator implementing line breaks. Line
breaks are logically possible line breaks, actual line breaks are
usually determined based on display width.
LineBreak is useful for word wrapping text.
return getLineInstance(Locale.getDefault());
|
public static java.text.BreakIterator | getLineInstance(java.util.Locale where)Create BreakIterator for line-breaks using specified locale.
Returns an instance of a BreakIterator implementing line breaks. Line
breaks are logically possible line breaks, actual line breaks are
usually determined based on display width.
LineBreak is useful for word wrapping text.
return getBreakInstance(where,
LINE_INDEX,
"LineData",
"LineDictionary");
|
protected static long | getLong(byte[] buf, int offset)
long num = buf[offset]&0xFF;
for (int i = 1; i < 8; i++) {
num = num<<8 | (buf[offset+i]&0xFF);
}
return num;
|
public static java.text.BreakIterator | getSentenceInstance()Create BreakIterator for sentence-breaks using default locale
Returns an instance of a BreakIterator implementing sentence breaks.
return getSentenceInstance(Locale.getDefault());
|
public static java.text.BreakIterator | getSentenceInstance(java.util.Locale where)Create BreakIterator for sentence-breaks using specified locale
Returns an instance of a BreakIterator implementing sentence breaks.
return getBreakInstance(where,
SENTENCE_INDEX,
"SentenceData",
"SentenceDictionary");
|
protected static short | getShort(byte[] buf, int offset)
short num = (short)(buf[offset]&0xFF);
num = (short)(num<<8 | (buf[offset+1]&0xFF));
return num;
|
public abstract java.text.CharacterIterator | getText()Get the text being scanned
|
public static java.text.BreakIterator | getWordInstance()Create BreakIterator for word-breaks using default locale.
Returns an instance of a BreakIterator implementing word breaks.
WordBreak is usefull for word selection (ex. double click)
return getWordInstance(Locale.getDefault());
|
public static java.text.BreakIterator | getWordInstance(java.util.Locale where)Create BreakIterator for word-breaks using specified locale.
Returns an instance of a BreakIterator implementing word breaks.
WordBreak is usefull for word selection (ex. double click)
return getBreakInstance(where,
WORD_INDEX,
"WordData",
"WordDictionary");
|
public boolean | isBoundary(int offset)Return true if the specified position is a boundary position.
// NOTE: This implementation probably is wrong for most situations
// because it fails to take into account the possibility that a
// CharacterIterator passed to setText() may not have a begin offset
// of 0. But since the abstract BreakIterator doesn't have that
// knowledge, it assumes the begin offset is 0. If you subclass
// BreakIterator, copy the SimpleTextBoundary implementation of this
// function into your subclass. [This should have been abstract at
// this level, but it's too late to fix that now.]
if (offset == 0)
return true;
else
return following(offset - 1) == offset;
|
public abstract int | last()Return the last boundary. The iterator's current position is set
to the last boundary.
|
public abstract int | next(int n)Return the nth boundary from the current boundary
|
public abstract int | next()Return the boundary following the current boundary.
|
public int | preceding(int offset)Return the last boundary preceding the specfied offset.
The value returned is always less than the offset or the value
BreakIterator.DONE.
// NOTE: This implementation is here solely because we can't add new
// abstract methods to an existing class. There is almost ALWAYS a
// better, faster way to do this.
int pos = following(offset);
while (pos >= offset && pos != DONE)
pos = previous();
return pos;
|
public abstract int | previous()Return the boundary preceding the current boundary.
|
public void | setText(java.lang.String newText)Set a new text string to be scanned. The current scan
position is reset to first().
setText(new StringCharacterIterator(newText));
|
public abstract void | setText(java.text.CharacterIterator newText)Set a new text for scanning. The current scan
position is reset to first().
|