All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gnu.regexp.REMatchEnumeration

java.lang.Object
   |
   +----gnu.regexp.REMatchEnumeration

public class REMatchEnumeration
extends Object
implements Enumeration
An REMatchEnumeration enumerates regular expression matches over a given input text. You obtain a reference to an enumeration using the getMatchEnumeration() methods on an instance of RE.

REMatchEnumeration does lazy computation; that is, it will not search for a match until it needs to. If you'd rather just get all the matches at once in a big array, use the getAllMatches() methods on RE. However, using an enumeration can help speed performance when the entire text does not need to be searched immediately.

The enumerated type is especially useful when searching on an InputStream, because the InputStream read position cannot be guaranteed after calling getMatch() (see the description of that method for an explanation of why). Enumeration also saves a lot of overhead required when calling getMatch() multiple times.

Author:
Wes Biggs

Method Index

 o hasMoreElements()
Returns true if there are more matches in the input text.
 o hasMoreMatches()
Returns true if there are more matches in the input text.
 o hasMoreMatches(StringBuffer)
Returns true if there are more matches in the input text.
 o nextElement()
Returns the next match in the input text.
 o nextMatch()
Returns the next match in the input text.

Methods

 o hasMoreElements
 public boolean hasMoreElements()
Returns true if there are more matches in the input text.

 o hasMoreMatches
 public boolean hasMoreMatches()
Returns true if there are more matches in the input text.

 o hasMoreMatches
 public boolean hasMoreMatches(StringBuffer f_buffer)
Returns true if there are more matches in the input text. Saves the text leading up to the match (or to the end of the input) in the specified buffer.

 o nextElement
 public Object nextElement() throws NoSuchElementException
Returns the next match in the input text.

 o nextMatch
 public REMatch nextMatch() throws NoSuchElementException
Returns the next match in the input text. This method is provided for convenience to avoid having to explicitly cast the return value to class REMatch.


All Packages  Class Hierarchy  This Package  Previous  Next  Index