gnu.regexp

Class REFilterInputStream

public class REFilterInputStream extends FilterInputStream

Deprecated: This class cannot properly handle all character encodings. For proper handling, use the REFilterReader class instead.

Replaces instances of a given RE found within an InputStream with replacement text. The replacements are interpolated into the stream when a match is found.

Author: Wes Biggs

Constructor Summary
REFilterInputStream(InputStream stream, RE expr, String replace)
Creates an REFilterInputStream.
Method Summary
booleanmarkSupported()
Returns false.
intread()
Reads the next byte from the stream per the general contract of InputStream.read().
intread(byte[] b, int off, int len)
Reads from the stream into the provided array.
intread(byte[] b)
Reads from the stream into the provided array.

Constructor Detail

REFilterInputStream

public REFilterInputStream(InputStream stream, RE expr, String replace)
Creates an REFilterInputStream. When reading from this stream, occurrences of patterns matching the supplied regular expression will be replaced with the supplied replacement text (the metacharacters $0 through $9 may be used to refer to the full match or subexpression matches).

Parameters: stream The InputStream to be filtered. expr The regular expression to search for. replace The text pattern to replace matches with.

Method Detail

markSupported

public boolean markSupported()
Returns false. REFilterInputStream does not support mark() and reset() methods.

read

public int read()
Reads the next byte from the stream per the general contract of InputStream.read(). Returns -1 on error or end of stream.

read

public int read(byte[] b, int off, int len)
Reads from the stream into the provided array.

read

public int read(byte[] b)
Reads from the stream into the provided array.