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.utils.io
Class LineFilterReader

    java.lang.Object
      java.io.Reader
          java.io.FilterReader
              oracle.ifs.utils.io.LineFilterReader

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

    public class LineFilterReader

extends java.io.FilterReader

The LineFilterReader class reads character-based data from an underlying reader and filters each line using a StringProcessor. A line is defined by BufferedReader.readLine() -- lines are delimited by System.getProperty("line.separator"). However, one or more "continuation characters" can be specified to allow lines to extend past the end of line character(s). By default, the continuation character is set to '\\' (backslash).

Modified:
  sgarg 05/09/2001 Externalized strings, lsaenz 02/14/2000 Changed to use [new OsUtils()]., lsaenz 02/06/2000 Added import statement for OsUtils., lsaenz 11/13/1999 Added ability to delete lines from output, if the StringProcessor returns null as its output. Found out that EOL off by 1 bug remains...not a big deal, will figure it out later., lsaenz 11/08/1999 Fixed EOL off by 1 bug., lsaenz 11/03/1999 Added support for continuation characters., lsaenz 11/02/1999 Created.

Field Summary
`static java.lang.String` | `defaultContinuationChars` Default continuation characters used to specify that two lines should be joined together.
`static java.lang.String` | `defaultJoinString` Default join String used when joining two lines together.

Fields inherited from class java.io.FilterReader
`in`

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

Constructor Summary
`LineFilterReader(java.io.Reader in, StringProcessor strategy)` Creates a new LineFilterReader.

Method Summary
`static void` | `processFile(java.lang.String inputFile, StringProcessor strategy)` Processes a text file line by line with the given StringProcessor.
`static void` | `processFile(java.lang.String inputFile, java.lang.String outputFile, StringProcessor strategy)` Processes a text file line by line with the given StringProcessor.
`int` | `read()` Reads a single character.
`int` | `read(char[] cbuf, int off, int len)` Reads characters into an array, processing the underlying reader as they are read.
`void` | `setContinuationChars(java.lang.String chars)` Sets the continuation characters used to specify that two lines should be joined together.
`void` | `setJoinString(java.lang.String str)` Sets the String used when joining lines together.

Methods inherited from class java.io.FilterReader
`close, mark, markSupported, ready, reset, skip`

Methods inherited from class java.io.Reader
`read, read`

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

Field Detail

### defaultContinuationChars

    public static final java.lang.String defaultContinuationChars

  Description copied from class: `LineFilterReader`
  Default continuation characters used to specify that two lines should be joined together.

  See Also:
    Constant Field Values

### defaultJoinString

    public static final java.lang.String defaultJoinString

  Description copied from class: `LineFilterReader`
  Default join String used when joining two lines together.

  See Also:
    Constant Field Values

Constructor Detail

### LineFilterReader

    public LineFilterReader(java.io.Reader in,
                            StringProcessor strategy)

  Creates a new LineFilterReader.

  Parameters:
    `in` - the underlying Reader to filter
    `strategy` - the StringProcessor used to process each line

Method Detail

### setContinuationChars

    public void setContinuationChars(java.lang.String chars)

  Description copied from class: `LineFilterReader`
  Sets the continuation characters used to specify that two lines should be joined together.

  Parameters:
    `chars` - the continuation chracters to use.

### setJoinString

    public void setJoinString(java.lang.String str)

  Description copied from class: `LineFilterReader`
  Sets the String used when joining lines together.

  Parameters:
    `str` - the join String to use.

### read

    public int read()
             throws java.io.IOException

  Description copied from class: `LineFilterReader`
  Reads a single character. Processes the underlying reader dynamically while reading. This method will block until a character is available, an I/O error occurs, or the end of the stream is reached. Note: this method assumes this LineFilterReader's StringProcessor is not null.

  Overrides:
    `read` in class `java.io.FilterReader`
  Returns:
    The character read, as an integer in the range (0..16383) (0x00..0xffff), or -1 if the end of the stream has been reached.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### read

    public int read(char[] cbuf,
                    int off,
                    int len)
             throws java.io.IOException

  Description copied from class: `LineFilterReader`
  Reads characters into an array, processing the underlying reader as they are read. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

  Overrides:
    `read` in class `java.io.FilterReader`
  Parameters:
    `cbuf` - destination buffer
    `off` - offset at which to start storing characters
    `len` - maximum number of characters to read
  Returns:
    the number of bytes read, or -1 if the end of the stream has been reached.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
    `java.lang.NullPointerException` - if the destination buffer is null
    `java.lang.ArrayIndexOutOfBoundsException` - if the offset is out of bounds

### processFile

    public static void processFile(java.lang.String inputFile,
                                   StringProcessor strategy)
                            throws java.io.IOException,
                                   java.io.FileNotFoundException

  Description copied from class: `LineFilterReader`
  Processes a text file line by line with the given StringProcessor. Modifies the given file itself (a temporary file is used).

  Parameters:
    `inputFile` - the file to process.
    `strategy` - StringProcessor to use for processing each line.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
    `java.io.FileNotFoundException` - if the inputFile cannot be found.

### processFile

    public static void processFile(java.lang.String inputFile,
                                   java.lang.String outputFile,
                                   StringProcessor strategy)
                            throws java.io.IOException,
                                   java.io.FileNotFoundException

  Description copied from class: `LineFilterReader`
  Processes a text file line by line with the given StringProcessor.

  Parameters:
    `inputFile` - the file to process.
    `outputFile` - the file to save changes into.
    `strategy` - StringProcessor to use for processing each line.
  Throws:
    `java.io.IOException` - if an I/O error occurs.
    `java.io.FileNotFoundException` - if the inputFile cannot be found.

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