public class DelimiterFilterReader extends Reader
Reader that allows on-the-fly filtering of a character-stream read from another reader. The
reader searches for character sequences that are surrounded by a start and an end delimiter. If
such a sequence is found it is passed to the provided DelimiterFilterMatchProcessor which
can manipulate the sequence before it is returned to the caller.
Since this reader is just reading from the provided reader, it is advisable to wrap that reader in a BufferedReader if the read operation is costly.
Note: the reader is not thread-safe| Constructor and Description |
|---|
DelimiterFilterReader(Reader reader,
String startDelimiter,
String endDelimiter,
DelimiterFilterMatchProcessor matchProcessor)
Create a new filtering reader
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
int |
read() |
int |
read(char[] cbuf,
int off,
int len) |
void |
reset() |
public DelimiterFilterReader(Reader reader, String startDelimiter, String endDelimiter, DelimiterFilterMatchProcessor matchProcessor)
reader - the underlying reader that provides the character stream that should be filteredstartDelimiter - the delimiter marking the start of a matchendDelimiter - the delimiter marking the end of a matchmatchProcessor - the processor to invoke when a match was foundpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class ReaderIOExceptionpublic int read()
throws IOException
read in class ReaderIOExceptionpublic int read(char[] cbuf,
int off,
int len)
throws IOException
read in class ReaderIOExceptionpublic void reset()
throws IOException
reset in class ReaderIOExceptionCopyright © 2019 Communote team. All rights reserved.