<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<!--NewPage-->
<html>
<head>
<!-- Generated by javadoc on Wed Jul 28 01:21:15 GMT 1999 -->
<title>
  Interface java.text.CharacterIterator
</title>
</head>
<body>
<a name="_top_"></a>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="Package-java.text.html">Previous</a>  <a href="Package-java.text.html">Next</a>  <a href="AllNames.html">Index</a></pre>
<hr>
<h1>
  Interface java.text.CharacterIterator
</h1>
<dl>
  <dt> public interface <b>CharacterIterator</b>
  <dt> extends <a href="java.lang.Cloneable.html#_top_">Cloneable</a>
</dl>
This interface defines a protocol for bidirectional iteration over text.
 The iterator iterates over a bounded sequence of characters.  Characters
 are indexed with values beginning with the value returned by getBeginIndex and
 continuing through the value returned by getEndIndex()-1.  The index of the
 current character can be retrieved by calling getIndex.  Calling setIndex
 will move the iterator to a new position within the sequence of characters.
 If at any time the iterator's current index moves outside the range of
 getBeginIndex and getEndIndex, previous() and next() will return DONE, signaling that
 the iterator has reached the end of the sequence.
 <P>Examples:<P>
 Traverse the text from start to finish
 <pre>
 public void traverseForward(CharacterIterator iter) {
     for(char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
         processChar(c);
     }
 }
 </pre>
 Traverse the text backwards, from end to start
 <pre>
 public void traverseBackward(CharacterIterator iter) {
     for(char c = iter.last(); c != CharacterIterator.DONE; c = iter.prev()) {
         processChar(c);
     }
 }
 </pre>
 Traverse both forward and backward from a given position in the text.
 Calls to notBoundary() in this example represents some
 additional stopping criteria.
 <pre>
 public void traverseOut(CharacterIterator iter, int pos) {
     for (char c = iter.setIndex(pos);
          c != CharacterIterator.DONE && notBoundary(c);
          c = iter.next()) {}
 int end = iter.getIndex();
 for (char c = iter.setIndex(pos);
     c != CharacterIterator.DONE && notBoundary(c);
     c = iter.prev()) {}
 int start = iter.getIndex();
 processSection(start,end);
 }
 </pre>
<p>
<dl>
    <dt> <b>See Also:</b>
    <dd> <a href="java.text.StringCharacterIterator.html#_top_">StringCharacterIterator</a>
</dl>
<hr>
<a name="index"></a>
<h2>
  <img src="images/variable-index.gif" width=207 height=38 alt="Variable Index">
</h2>
<dl>
  <dt> <img src="images/blue-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#DONE"><b>DONE</b></a>
  <dd>  Constant that is returned when the iterator has reached either the end
 or the beginning of the text.
</dl>
<h2>
  <img src="images/method-index.gif" width=207 height=38 alt="Method Index">
</h2>
<dl>
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#clone()"><b>clone</b></a>()
  <dd>  Create a copy of this iterator
 
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#current()"><b>current</b></a>()
  <dd>  Get the character at the current position (as returned by getIndex()).
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#first()"><b>first</b></a>()
  <dd>  Set the position to getBeginIndex() and return the character at that
 position.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getBeginIndex()"><b>getBeginIndex</b></a>()
  <dd>  Return the start index of the text.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getEndIndex()"><b>getEndIndex</b></a>()
  <dd>  Return the end index of the text.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#getIndex()"><b>getIndex</b></a>()
  <dd>  Return the current index.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#last()"><b>last</b></a>()
  <dd>  Set the position to getEndIndex()-1, return the character at that position.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#next()"><b>next</b></a>()
  <dd>  Increment the iterator's index by one and return the character
 at the new index.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#previous()"><b>previous</b></a>()
  <dd>  Decrement the iterator's index by one and return the character
 at the new index.
  <dt> <img src="images/red-ball-small.gif" width=6 height=6 alt=" o ">
	<a href="#setIndex(int)"><b>setIndex</b></a>(int)
  <dd>  Set the position to the specified position in the text and return that
 character.
</dl>
<a name="variables"></a>
<h2>
  <img src="images/variables.gif" width=153 height=38 alt="Variables">
</h2>
<a name="DONE"><img src="images/blue-ball.gif" width=12 height=12 alt=" o "></a>
<b>DONE</b>
<pre>
 public static final char DONE
</pre>
<dl>
  <dd> Constant that is returned when the iterator has reached either the end
 or the beginning of the text.  The unicode 2.0 standard states that
 '\\uFFFF' is an invalid unicode value and should not occur in any valid
 unicode string.<p>
</dl>
<a name="methods"></a>
<h2>
  <img src="images/methods.gif" width=151 height=38 alt="Methods">
</h2>
<a name="first()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="first"><b>first</b></a>
<pre>
 public abstract char first()
</pre>
<dl>
  <dd> Set the position to getBeginIndex() and return the character at that
 position.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the first character in the text
    <dt> <b>See Also:</b>
    <dd> getBeginIndex
  </dl></dd>
</dl>
<a name="last()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="last"><b>last</b></a>
<pre>
 public abstract char last()
</pre>
<dl>
  <dd> Set the position to getEndIndex()-1, return the character at that position.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the last character in the text
    <dt> <b>See Also:</b>
    <dd> getEndIndex
  </dl></dd>
</dl>
<a name="current()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="current"><b>current</b></a>
<pre>
 public abstract char current()
</pre>
<dl>
  <dd> Get the character at the current position (as returned by getIndex()).
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the character at the current position or DONE if the current
 position is off the end of the text.
    <dt> <b>See Also:</b>
    <dd> getIndex
  </dl></dd>
</dl>
<a name="next()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="next"><b>next</b></a>
<pre>
 public abstract char next()
</pre>
<dl>
  <dd> Increment the iterator's index by one and return the character
 at the new index.  If the resulting index is greater or equal
 to getEndIndex(), the current index is reset to getEndIndex() and
 a value of DONE is returned.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the character at the new position or DONE if the current
 position is off the end of the text.
  </dl></dd>
</dl>
<a name="previous()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="previous"><b>previous</b></a>
<pre>
 public abstract char previous()
</pre>
<dl>
  <dd> Decrement the iterator's index by one and return the character
 at the new index.  If the resulting index is
 less than getBeginIndex(), the current index is reset to getBeginIndex()
 and a value of DONE is returned.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the character at the new position or DONE if the current
 position is off the end of the text.
  </dl></dd>
</dl>
<a name="setIndex(int)"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="setIndex"><b>setIndex</b></a>
<pre>
 public abstract char setIndex(int position)
</pre>
<dl>
  <dd> Set the position to the specified position in the text and return that
 character.
<p>
  <dd><dl>
    <dt> <b>Parameters:</b>
    <dd> position - the position within the text.  Valid values range from
 getBeginIndex() to getEndIndex() - 1.  An IllegalArgumentException is thrown
 if an invalid value is supplied.
    <dt> <b>Returns:</b>
    <dd> the character at the specified position.
  </dl></dd>
</dl>
<a name="getBeginIndex()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getBeginIndex"><b>getBeginIndex</b></a>
<pre>
 public abstract int getBeginIndex()
</pre>
<dl>
  <dd> Return the start index of the text.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the index at which the text begins.
  </dl></dd>
</dl>
<a name="getEndIndex()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getEndIndex"><b>getEndIndex</b></a>
<pre>
 public abstract int getEndIndex()
</pre>
<dl>
  <dd> Return the end index of the text.  This index is the index of the first
 character following the end of the text.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the index at which the text end.
  </dl></dd>
</dl>
<a name="getIndex()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="getIndex"><b>getIndex</b></a>
<pre>
 public abstract int getIndex()
</pre>
<dl>
  <dd> Return the current index.
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> the current index.
  </dl></dd>
</dl>
<a name="clone()"><img src="images/red-ball.gif" width=12 height=12 alt=" o "></a>
<a name="clone"><b>clone</b></a>
<pre>
 public abstract <a href="java.lang.Object.html#_top_">Object</a> clone()
</pre>
<dl>
  <dd> Create a copy of this iterator
<p>
  <dd><dl>
    <dt> <b>Returns:</b>
    <dd> A copy of this
    <dt> <b>Overrides:</b>
    <dd> <a href="java.lang.Object.html#clone()">clone</a> in class <a href="java.lang.Object.html#_top_">Object</a>
  </dl></dd>
</dl>
<hr>
<pre>
<a href="packages.html">All Packages</a>  <a href="tree.html">Class Hierarchy</a>  <a href="Package-java.text.html">This Package</a>  <a href="Package-java.text.html">Previous</a>  <a href="Package-java.text.html">Next</a>  <a href="AllNames.html">Index</a></pre>
</body>
</html>
