Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.ifs.beans.parsers
Class ParserReader

    java.lang.Object
      java.io.Reader
          oracle.ifs.beans.parsers.ParserReader

All Implemented Interfaces:
  java.io.Closeable, java.lang.Readable

    public class ParserReader

extends java.io.Reader

A ParserReader is a Reader that supports buffering of input such that the buffer can be reset to the beginning, allowing characters to be re-read.

As such, a ParserReader can be used whenever the input data needs to be re-read. For example, it is used for pre-parsing a file to determine the nature of its content, before passing it to the appropriate parser for actual parsing.

It can operate in buffering or non-buffering mode. When in buffering mode, it buffers the input, extending the size of the buffer as required.

The ParserReader can be reset to allow re-reading of the input data. When reset and put in non-buffering mode, it consumes the characters in the buffer to service read requests, until it reaches the end of the buffered data, at which point it will start reading from the underlying Reader. When reset and operating in buffering mode, it consumes the characters in the buffer to service read requests, until it reaches the end of the buffered data, at which point it will read more data into the buffer and services read requests from the contents of the buffer.

A ParserReader can only be reset if already in buffering mode.

(Unpublished)

Field Summary

Fields inherited from class java.io.Reader
`lock`

Constructor Summary
`ParserReader(java.io.Reader reader)` Constructs a ParserReader from a Reader.

Method Summary
`void` | `close()`
`boolean` | `getBufferingMode()` Gets the buffering mode indicating whether the reader is currently in buffering mode or non-buffering mode.
`int` | `read()` Reads the next character of data from this reader.
`int` | `read(char[] ch)` Reads up to c.length characters of data from this reader into the array of characters.
`int` | `read(char[] ch, int offset, int len)` Reads up to len characters of data from this reader into an array of characters at the position specified by offset.
`void` | `resetStream(boolean bufferingMode)` Resets the reader such that it can be re-read.
`void` | `setBufferingMode(boolean mode)` Set the reader into the desired mode.

Methods inherited from class java.io.Reader
`mark, markSupported, read, ready, reset, skip`

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

Constructor Detail

### ParserReader

    public ParserReader(java.io.Reader reader)

  Constructs a ParserReader from a Reader.

  Parameters:
    `reader` - the Reader
  (Unpublished)

Method Detail

### read

    public int read()
             throws java.io.IOException

  Description copied from class: `ParserReader`
  Reads the next character of data from this reader.

  The character is returned as an int in the range 0 to 16383. If no character is available because the end of the stream has been reached, the value -1 is returned.

  Overrides:
    `read` in class `java.io.Reader`
  Returns:
    the charcater read, or -1 when the end of the stream has been reached
  Throws:
    `java.io.IOException` - if an I/O error occurs
  (Unpublished)

### read

    public int read(char[] ch)
             throws java.io.IOException

  Description copied from class: `ParserReader`
  Reads up to c.length characters of data from this reader into the array of characters.

  Overrides:
    `read` in class `java.io.Reader`
  Parameters:
    `ch` - the buffer into which the data is read
  Returns:
    the total number of characters read into the buffer, or -1 when the end of the stream has been reached
  Throws:
    `java.io.IOException` - if an I/O error occurs
  (Unpublished)

### read

    public int read(char[] ch,
                    int offset,
                    int len)
             throws java.io.IOException

  Description copied from class: `ParserReader`
  Reads up to len characters of data from this reader into an array of characters at the position specified by offset.

  Specified by:
    `read` in class `java.io.Reader`
  Parameters:
    `ch` - the buffer into which the data is read
    `offset` - the start offset of the data
    `len` - the maximum number of characters read
  Returns:
    the total number of characters read into the buffer, or -1 when the end of the stream has been reached
  Throws:
    `java.io.IOException` - if an I/O error occurs
  (Unpublished)

### setBufferingMode

    public void setBufferingMode(boolean mode)

  Description copied from class: `ParserReader`
  Set the reader into the desired mode.

  If true is passed in, the reader is put into buffering mode, so that it can be reset subsequently to re-read the data. If false is passed in, the reader is put into non-buffering mode, and it cannot be subsequently reset.

  Parameters:
    `mode` - can be true or false, indicating whether the reader should be put into buffering mode or non-buffering mode mode
  (Unpublished)

### getBufferingMode

    public boolean getBufferingMode()

  Description copied from class: `ParserReader`
  Gets the buffering mode indicating whether the reader is currently in buffering mode or non-buffering mode.

  Returns:
    true or false, indicating whether the reader is currently in buffering or non-buffering mode
  (Unpublished)

### resetStream

    public void resetStream(boolean bufferingMode)
                     throws IfsException

  Description copied from class: `ParserReader`
  Resets the reader such that it can be re-read. The reader can continue to operate in buffering mode after the reset, or it can be set to non buffering mode following reset. The buffering mode should be set according to how many times the stream is going to be re-read.

  Parameters:
    `bufferingMode` - determines whether the reader should continue in buffering mode after being reset.
  Throws:
    `IfsException` - if attempting to reset a reader that is not in buffering mode
  (Unpublished)

### close

    public void close()
               throws java.io.IOException

  Specified by:
    `close` in interface `java.io.Closeable`
  Specified by:
    `close` in class `java.io.Reader`
  Throws:
    `java.io.IOException`
  (Unpublished)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD