Package com.ibm.icu.util
Class UResourceBundleIterator
- java.lang.Object
-
- com.ibm.icu.util.UResourceBundleIterator
-
public class UResourceBundleIterator extends java.lang.Object
Class for enabling iteration over UResourceBundle objects. Example of use:
ICUResourceBundleIterator iterator = resB.getIterator(); ICUResourceBundle temp; while (iterator.hasNext()) { temp = iterator.next(); int type = temp.getType(); switch(type){ case UResourceBundle.STRING: str = temp.getString(); break; case UResourceBundle.INT: integer = temp.getInt(); break; ..... } // do something interesting with data collected }
-
-
Field Summary
Fields Modifier and Type Field Description private UResourceBundle
bundle
private int
index
private int
size
-
Constructor Summary
Constructors Constructor Description UResourceBundleIterator(UResourceBundle bndl)
Construct a resource bundle iterator for the given resource bundle
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Checks whether the given resource has another element to iterate over.UResourceBundle
next()
Returns the next element of this iterator if this iterator object has at least one more element to providejava.lang.String
nextString()
Returns the next String of this iterator if this iterator object has at least one more element to providevoid
reset()
Resets the internal context of a resource so that iteration starts from the first element.
-
-
-
Field Detail
-
bundle
private UResourceBundle bundle
-
index
private int index
-
size
private int size
-
-
Constructor Detail
-
UResourceBundleIterator
public UResourceBundleIterator(UResourceBundle bndl)
Construct a resource bundle iterator for the given resource bundle- Parameters:
bndl
- The resource bundle to iterate over
-
-
Method Detail
-
next
public UResourceBundle next() throws java.util.NoSuchElementException
Returns the next element of this iterator if this iterator object has at least one more element to provide- Returns:
- the UResourceBundle object
- Throws:
java.util.NoSuchElementException
- If there does not exist such an element.
-
nextString
public java.lang.String nextString() throws java.util.NoSuchElementException, UResourceTypeMismatchException
Returns the next String of this iterator if this iterator object has at least one more element to provide- Returns:
- the UResourceBundle object
- Throws:
java.util.NoSuchElementException
- If there does not exist such an element.UResourceTypeMismatchException
- If resource has a type mismatch.
-
reset
public void reset()
Resets the internal context of a resource so that iteration starts from the first element.
-
hasNext
public boolean hasNext()
Checks whether the given resource has another element to iterate over.- Returns:
- true if there are more elements, false if there is no more elements
-
-