GXPARSE hosted by SourceForge.net Logo

ca.gorman.util.scan
Interface InputScanBuffer

All Superinterfaces:
CharSequence, Expandable, ScanBuffer
All Known Implementing Classes:
AbstractScanBuffer

public interface InputScanBuffer
extends ScanBuffer

The sequence of characters that are currently available for pattern matching.

Some implementations of ScanBuffer may hold much more data than will fit in memory. In such cases, copying very large numbers of characters to memory or invoking the toString() on the ScanBuffer (or on a large subsequence of the ScanBuffer) may cause an OutOfMemoryError.

The content of a ScanBuffer, and any of its subsquences or sub-buffers, is undefined outside an instance of ScanMatch, ScanAction, or ScanRule. When persistent data is required, the data should be obtained by copying the characters or by invoking the toString method of the appropriate ScanBuffer, subsequence or sub-buffer.


Method Summary
 void discardMatchedText()
           Release all previously accepted input data.
 int fill()
           Read characters into free space in the buffer.
 Map<String,CharSequence> getMap()
           Get the map that supports saving and retrieving character sequences as temporary values.
 boolean hitLast()
           Indicate whether the last character in the buffer has been accessed since the previous invocation of this function.
 ScanState setScanState(ScanState scanState)
           Set a reference to the scanner state for use by the buffer match and act method.
 
Methods inherited from interface ca.gorman.util.scan.ScanBuffer
accept, act, put, subBuffer
 
Methods inherited from interface java.lang.CharSequence
charAt, length, subSequence, toString
 
Methods inherited from interface ca.gorman.util.scan.Expandable
expand
 

Method Detail

discardMatchedText

void discardMatchedText()
                        throws IOException

Release all previously accepted input data.

Warning: In some implementations, the previously accepted MatchedText instances will no longer contain valid data.

Throws:
IOException

fill

int fill()
         throws IOException

Read characters into free space in the buffer.

This method may block until characters become available.

Returns:
The number of new characters read in, or -1 if the buffer is empty and no more characters will ever be available.
Throws:
IOException

hitLast

boolean hitLast()

Indicate whether the last character in the buffer has been accessed since the previous invocation of this function.

Resets the indicator to false until the next time that the last character is accessed.


getMap

Map<String,CharSequence> getMap()

Get the map that supports saving and retrieving character sequences as temporary values.


setScanState

ScanState setScanState(ScanState scanState)

Set a reference to the scanner state for use by the buffer match and act method.

Returns:
previous scanner state

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License