< prev index next >

src/java.base/share/classes/sun/text/normalizer/UCharacterIterator.java

Print this page




 183      */
 184     public abstract int previous();
 185 
 186     /**
 187      * Sets the index to the specified index in the text.
 188      * @param index the index within the text.
 189      * @exception IndexOutOfBoundsException is thrown if an invalid index is
 190      *            supplied
 191      * @stable ICU 2.4
 192      */
 193     public abstract void setIndex(int index);
 194 
 195     //// for StringPrep
 196     /**
 197      * Fills the buffer with the underlying text storage of the iterator
 198      * If the buffer capacity is not enough a exception is thrown. The capacity
 199      * of the fill in buffer should at least be equal to length of text in the
 200      * iterator obtained by calling <code>getLength()</code>.
 201      * <b>Usage:</b>
 202      *
 203      * <code>
 204      * <pre>
 205      *         UChacterIterator iter = new UCharacterIterator.getInstance(text);
 206      *         char[] buf = new char[iter.getLength()];
 207      *         iter.getText(buf);
 208      *
 209      *         OR
 210      *         char[] buf= new char[1];
 211      *         int len = 0;
 212      *         for(;;){
 213      *             try{
 214      *                 len = iter.getText(buf);
 215      *                 break;
 216      *             }catch(IndexOutOfBoundsException e){
 217      *                 buf = new char[iter.getLength()];
 218      *             }
 219      *         }
 220      * </pre>
 221      * </code>
 222      *
 223      * @param fillIn an array of chars to fill with the underlying UTF-16 code
 224      *         units.
 225      * @param offset the position within the array to start putting the data.
 226      * @return the number of code units added to fillIn, as a convenience
 227      * @exception IndexOutOfBounds exception if there is not enough
 228      *            room after offset in the array, or if offset < 0.
 229      * @stable ICU 2.4
 230      */
 231     public abstract int getText(char[] fillIn, int offset);
 232 
 233     //// for StringPrep
 234     /**
 235      * Convenience override for <code>getText(char[], int)</code> that provides
 236      * an offset of 0.
 237      * @param fillIn an array of chars to fill with the underlying UTF-16 code
 238      *         units.
 239      * @return the number of code units added to fillIn, as a convenience
 240      * @exception IndexOutOfBounds exception if there is not enough
 241      *            room in the array.
 242      * @stable ICU 2.4
 243      */
 244     public final int getText(char[] fillIn) {
 245         return getText(fillIn, 0);
 246     }
 247 
 248     //// for StringPrep




 183      */
 184     public abstract int previous();
 185 
 186     /**
 187      * Sets the index to the specified index in the text.
 188      * @param index the index within the text.
 189      * @exception IndexOutOfBoundsException is thrown if an invalid index is
 190      *            supplied
 191      * @stable ICU 2.4
 192      */
 193     public abstract void setIndex(int index);
 194 
 195     //// for StringPrep
 196     /**
 197      * Fills the buffer with the underlying text storage of the iterator
 198      * If the buffer capacity is not enough a exception is thrown. The capacity
 199      * of the fill in buffer should at least be equal to length of text in the
 200      * iterator obtained by calling <code>getLength()</code>.
 201      * <b>Usage:</b>
 202      *
 203      * <pre>{@code

 204      *         UChacterIterator iter = new UCharacterIterator.getInstance(text);
 205      *         char[] buf = new char[iter.getLength()];
 206      *         iter.getText(buf);
 207      *
 208      *         OR
 209      *         char[] buf= new char[1];
 210      *         int len = 0;
 211      *         for(;;){
 212      *             try{
 213      *                 len = iter.getText(buf);
 214      *                 break;
 215      *             }catch(IndexOutOfBoundsException e){
 216      *                 buf = new char[iter.getLength()];
 217      *             }
 218      *         }
 219      * }</pre>

 220      *
 221      * @param fillIn an array of chars to fill with the underlying UTF-16 code
 222      *         units.
 223      * @param offset the position within the array to start putting the data.
 224      * @return the number of code units added to fillIn, as a convenience
 225      * @exception IndexOutOfBounds exception if there is not enough
 226      *            room after offset in the array, or if offset {@literal <} 0.
 227      * @stable ICU 2.4
 228      */
 229     public abstract int getText(char[] fillIn, int offset);
 230 
 231     //// for StringPrep
 232     /**
 233      * Convenience override for <code>getText(char[], int)</code> that provides
 234      * an offset of 0.
 235      * @param fillIn an array of chars to fill with the underlying UTF-16 code
 236      *         units.
 237      * @return the number of code units added to fillIn, as a convenience
 238      * @exception IndexOutOfBounds exception if there is not enough
 239      *            room in the array.
 240      * @stable ICU 2.4
 241      */
 242     public final int getText(char[] fillIn) {
 243         return getText(fillIn, 0);
 244     }
 245 
 246     //// for StringPrep


< prev index next >