public class TemplateReader extends FilterReader
${key} or $key
in the underlying stream with the string representations of any non-null value returned by a given
resolver for that key.| Modifier and Type | Class and Description |
|---|---|
static interface |
TemplateReader.Resolver |
in| Constructor and Description |
|---|
TemplateReader(Reader in,
Map map)
Constructs a template reader for the given reader stream and a resolver given by a
Map. |
TemplateReader(Reader in,
TemplateReader.Resolver resolver)
Constructs a template reader for the given reader stream and the given resolver.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stream.
|
char |
getKeyIndicator()
Gets the key indicator.
|
void |
mark(int readAheadLimit)
Mark the present position in the stream.
|
boolean |
markSupported()
Tell whether this stream supports the mark() operation.
|
int |
read()
Read a single character.
|
int |
read(char[] cbuf)
Read characters into an array.
|
int |
read(char[] cbuf,
int off,
int len)
Read characters into a portion of an array.
|
int |
read(CharBuffer target)
Attempts to read characters into the specified character buffer.
|
String |
readAll()
Reads all content.
|
boolean |
ready()
Tell whether this stream is ready to be read.
|
void |
reset()
Reset the stream.
|
void |
setKeyIndicator(char keyIndicator)
Sets the key indicator.
|
long |
skip(long n)
Skip characters.
|
public TemplateReader(Reader in, Map map)
Map.in - the underlying readermap - the map to serve as resolverpublic TemplateReader(Reader in, TemplateReader.Resolver resolver)
in - the underlying readerresolver - the resolverpublic char getKeyIndicator()
public void setKeyIndicator(char keyIndicator)
keyIndicator - the key indicator, must not be a digit, letter or whitespace.public String readAll() throws IOException
IOException - if an I/O error occurspublic int read()
throws IOException
read in class FilterReaderIOException - If an I/O error occurspublic int read(char[] cbuf)
throws IOException
read in class Readercbuf - Destination bufferIOException - If an I/O error occurspublic int read(char[] cbuf,
int off,
int len)
throws IOException
read in class FilterReaderIOException - If an I/O error occurspublic int read(CharBuffer target) throws IOException
read in interface Readableread in class Readertarget - the buffer to read characters intoIOException - if an I/O error occursNullPointerException - if target is nullReadOnlyBufferException - if target is a read only bufferpublic long skip(long n)
throws IOException
skip in class FilterReaderIOException - If an I/O error occurspublic boolean ready()
throws IOException
ready in class FilterReaderIOException - If an I/O error occurspublic boolean markSupported()
markSupported in class FilterReaderpublic void mark(int readAheadLimit)
throws IOException
mark in class FilterReaderIOException - If an I/O error occurspublic void reset()
throws IOException
reset in class FilterReaderIOException - If an I/O error occurspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterReaderIOException - If an I/O error occursCopyright © 2014–2015 European Space Agency (ESA). All rights reserved.