Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.rules
Class AbleARLTokenStreamCache

    java.lang.Object
      com.ibm.able.rules.AbleARLTokenStreamCache

All Implemented Interfaces:
  antlr.TokenStream

public class AbleARLTokenStreamCache
extends java.lang.Object
implements antlr.TokenStream

This class is a specialized TokenStream that caches the contents of each token as it is obtained from the specified input stream, and can be used anywhere an ANTLR TokenStream can be used.

The contents of the cache can be obtained as a String or as a byte array. The latter might be useful in creating an input stream to pass to an ABLE lexer/parser to reparse the original stream.

Field Summary
`protected int` | `myLine` The current line in the input stream that is being parsed.
`protected java.lang.String` | `myPref` Prefix to the current line.
`protected java.lang.StringBuffer` | `myStringBuffer` The cached input stream, created from the individual tokens as each token is obtained from the input stream.
`protected antlr.TokenStream` | `myTokenStream` The 'real' input stream from which tokens are obtained; passed in through the constructor, and must never be null.

Constructor Summary
`AbleARLTokenStreamCache(antlr.TokenStream theTokenStream)` Creates a new token stream cache.

Method Summary
`byte[]` | `getBytes()` Retrieves the current token cache as a byte array, which subsequently can be used to create an InputStream which can be used to reparse the stream.
`java.lang.String` | `getString()` Retrieves the current token cache as a string.
`int` | `length()` Retrieves the length of the current token cache.
`antlr.Token` | `nextToken()` Obtains and returns the next token from the input stream.
`java.lang.String` | `toString()` Retrieves the contents of the object as a string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### myTokenStream

    protected antlr.TokenStream myTokenStream

  The 'real' input stream from which tokens are obtained; passed in through the constructor, and must never be null.

### myStringBuffer

    protected java.lang.StringBuffer myStringBuffer

  The cached input stream, created from the individual tokens as each token is obtained from the input stream.

### myLine

    protected int myLine

  The current line in the input stream that is being parsed.

### myPref

    protected java.lang.String myPref

  Prefix to the current line. Two blanks added each time "{" found; same removed each time "}" found.

Constructor Detail

### AbleARLTokenStreamCache

    public AbleARLTokenStreamCache(antlr.TokenStream theTokenStream)

  Creates a new token stream cache.

Parameters:
  `theTokenStream` - The input stream from which tokens are to be obtained and cached.

Method Detail

### nextToken

    public antlr.Token nextToken()
                          throws antlr.TokenStreamException

  Obtains and returns the next token from the input stream. The contents of the token are cached.

  Specified by:
    `nextToken` in interface `antlr.TokenStream`
  Returns:
    A String containing the current contents of the cache.
  Throws:
    `antlr.TokenStreamException`

### getString

    public java.lang.String getString()

  Retrieves the current token cache as a string.

  Returns:
    A String containing the current contents of the cache.

### getBytes

    public byte[] getBytes()

  Retrieves the current token cache as a byte array, which subsequently can be used to create an InputStream which can be used to reparse the stream.

  Returns:
    A byte array containing the current contents of the cache.

### length

    public int length()

  Retrieves the length of the current token cache.

  Returns:
    The length, in number of characers, of the current token cache.

### toString

    public java.lang.String toString()

  Retrieves the contents of the object as a string.

  Returns:
    A String containing the current contents of the object.

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005