org.jruby.util.string
Class UcharIterator

java.lang.Object
  extended by org.jruby.util.string.UcharIterator
All Implemented Interfaces:
java.io.Serializable, java.util.Iterator

Deprecated.

@Deprecated
public class UcharIterator
extends java.lang.Object
implements java.util.Iterator, java.io.Serializable

UcharIterator - an Iterator on Unicode characters in a UTF-8 byte array.

A conventional Iterator, remove() is not supported, and there's an extra nextChar() method that returns a naked int as opposed to a wrapped Integer.

See Also:
Ustr, Serialized Form

Constructor Summary
UcharIterator(byte[] s, int offset)
          Deprecated. Creates a new UcharIterator starting at an offset in a buffer.
 
Method Summary
 boolean hasNext()
          Deprecated. Tests whether there are any more characters in the buffer.
 java.lang.Object next()
          Deprecated. Retrieve the next Unicode character from a UTF-8 byte buffer, wrapped in an Integer object.
 int nextChar()
          Deprecated. Retrieve the next Unicode character from a UTF-8 byte buffer and return it as an int.
 void remove()
          Deprecated. Throws an UnsupportedOperationException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UcharIterator

public UcharIterator(byte[] s,
                     int offset)
Deprecated. 
Creates a new UcharIterator starting at an offset in a buffer.

Parameters:
s - the byte array containing UTF-8-encoded Unicode characters.
offset - how far into the array to start iterating.
Method Detail

hasNext

public boolean hasNext()
Deprecated. 
Tests whether there are any more characters in the buffer.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true or false depending on whether there are more characters.

next

public java.lang.Object next()
Deprecated. 
Retrieve the next Unicode character from a UTF-8 byte buffer, wrapped in an Integer object. Throws NoSuchElementException if hasNext would return false.

Specified by:
next in interface java.util.Iterator
Returns:
the next Unicode character as a java.lang.Integer
Throws:
NoSuchElementException

nextChar

public int nextChar()
Deprecated. 
Retrieve the next Unicode character from a UTF-8 byte buffer and return it as an int. Once the null-termination is hit, returns 0 as many times as you want to call it.

Returns:
the next Unicode character as an int, 0 on end-of-string.

remove

public void remove()
Deprecated. 
Throws an UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException


Copyright © 2002-2007 JRuby Team. All Rights Reserved.