public class StringSubstitutorReader extends FilterReader
Reader that performs string substitution on a source Reader using a StringSubstitutor.
Using this Reader avoids reading a whole file into memory as a String to perform string substitution, for
example, when a Servlet filters a file to a client.
This class is not thread-safe.
in| Constructor and Description |
|---|
StringSubstitutorReader(Reader reader,
StringSubstitutor stringSubstitutor)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
read()
Reads a single character.
|
int |
read(char[] target,
int targetIndexIn,
int targetLengthIn)
Reads characters into a portion of an array.
|
close, mark, markSupported, ready, reset, skippublic StringSubstitutorReader(Reader reader, StringSubstitutor stringSubstitutor)
reader - the underlying reader containing the template text known to the given StringSubstitutor.stringSubstitutor - How to replace as we read.NullPointerException - if reader is null.NullPointerException - if stringSubstitutor is null.public int read() throws IOException
read in class FilterReaderint or -1 for end-of-stream.IOException - If an I/O error occurspublic int read(char[] target, int targetIndexIn, int targetLengthIn) throws IOException
read in class FilterReadertarget - Target buffer.targetIndexIn - Index in the target at which to start storing characters.targetLengthIn - Maximum number of characters to read.IOException - If an I/O error occursCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.