soot.coffi
Class Utf8_Enumeration

java.lang.Object
  extended by soot.coffi.Utf8_Enumeration
All Implemented Interfaces:
Enumeration

public class Utf8_Enumeration
extends Object
implements Enumeration

An enumeration of a Utf8 allows one to run through the characters in a unicode string; used primarily for comparing unicode strings. Note that unlike regular enumerations, and to be efficient (ie to avoid allocating an object in each call to nextElement), the return value is accessed by this object's 'c' field, and nextElement merely returns this.

Author:
Clark Verbrugge
See Also:
CONSTANT_Utf8_info, c, nextElement()

Field Summary
 int c
          The latest character, as determined by nextElement.
 
Constructor Summary
Utf8_Enumeration()
          For creating an empty enumeration; you must use reset() after this to initialize the enumeration.
Utf8_Enumeration(byte[] b)
          For creating a normal enumeration of the given Utf8 string.
 
Method Summary
 boolean hasMoreElements()
          true if the entire string hasn't been enumerated yet.
 Object nextElement()
          Determines the next Utf8 character, and stores it in c.
 void reset(byte[] b)
          Resets this object to be an enumeration of the given Utf8 string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

c

public int c
The latest character, as determined by nextElement.

See Also:
nextElement()
Constructor Detail

Utf8_Enumeration

public Utf8_Enumeration()
For creating an empty enumeration; you must use reset() after this to initialize the enumeration.

See Also:
reset(byte[])

Utf8_Enumeration

public Utf8_Enumeration(byte[] b)
For creating a normal enumeration of the given Utf8 string.

Parameters:
b - array of bytes in Utf8 format.
Method Detail

reset

public void reset(byte[] b)
Resets this object to be an enumeration of the given Utf8 string.

Parameters:
b - array of bytes in Utf8 format.

hasMoreElements

public boolean hasMoreElements()
true if the entire string hasn't been enumerated yet.

Specified by:
hasMoreElements in interface Enumeration

nextElement

public Object nextElement()
Determines the next Utf8 character, and stores it in c.

Specified by:
nextElement in interface Enumeration
Returns:
this
See Also:
c