Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.oro.text.awk
Class AwkStreamInput  view AwkStreamInput download AwkStreamInput.java

java.lang.Object
  extended byorg.apache.oro.text.awk.AwkStreamInput

public final class AwkStreamInput
extends java.lang.Object

The AwkStreamInput class is used to look for pattern matches in an input stream (actually a java.io.Reader instance) in conjunction with the AwkMatcher class. It is called AwkStreamInput instead of AwkInputStream to stress that it is a form of streamed input for the AwkMatcher class to use rather than a subclass of InputStream. AwkStreamInput performs special internal buffering to accelerate pattern searches through a stream. You can determine the size of this buffer and how it grows by using the appropriate constructor.

If you want to perform line by line matches on an input stream, you should use a DataInput or BufferedReader instance in conjunction with one of the PatternMatcher methods taking a String, char[], or PatternMatcherInput as an argument. The DataInput and BufferedReader readLine() methods will likely be implemented as native methods and therefore more efficient than supporting line by line searching within AwkStreamInput.

In the future the programmer will be able to set this class to save all the input it sees so that it can be accessed later. This will avoid having to read a stream more than once for whatever reason.

Since:
1.0
Version:
@version@

Field Summary
private  int __bufferIncrementUnit
           
private  java.io.Reader __searchStream
           
(package private)  char[] _buffer
           
(package private)  int _bufferOffset
           
(package private)  int _bufferSize
           
(package private)  int _currentOffset
           
(package private) static int _DEFAULT_BUFFER_INCREMENT
           
(package private)  boolean _endOfStreamReached
           
 
Constructor Summary
(package private) AwkStreamInput()
          We use this default contructor only within the package to create a dummy AwkStreamInput instance.
  AwkStreamInput(java.io.Reader input)
          Creates an AwkStreamInput instance bound to a Reader with an initial buffer size and default buffer increment of 2048 bytes.
  AwkStreamInput(java.io.Reader input, int bufferIncrement)
          Creates an AwkStreamInput instance bound to a Reader with a specified initial buffer size and default buffer increment.
 
Method Summary
(package private)  int _reallocate(int initialOffset)
           
 boolean endOfStream()
           
(package private)  boolean read()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_DEFAULT_BUFFER_INCREMENT

static final int _DEFAULT_BUFFER_INCREMENT
See Also:
Constant Field Values

__searchStream

private java.io.Reader __searchStream

__bufferIncrementUnit

private int __bufferIncrementUnit

_endOfStreamReached

boolean _endOfStreamReached

_bufferSize

int _bufferSize

_bufferOffset

int _bufferOffset

_currentOffset

int _currentOffset

_buffer

char[] _buffer
Constructor Detail

AwkStreamInput

AwkStreamInput()
We use this default contructor only within the package to create a dummy AwkStreamInput instance.


AwkStreamInput

public AwkStreamInput(java.io.Reader input,
                      int bufferIncrement)
Creates an AwkStreamInput instance bound to a Reader with a specified initial buffer size and default buffer increment.


AwkStreamInput

public AwkStreamInput(java.io.Reader input)
Creates an AwkStreamInput instance bound to a Reader with an initial buffer size and default buffer increment of 2048 bytes.

Method Detail

_reallocate

int _reallocate(int initialOffset)
          throws java.io.IOException

read

boolean read()
       throws java.io.IOException

endOfStream

public boolean endOfStream()