de.intarsys.tools.reader
public class DirectTagReader extends java.io.FilterReader
Reader
that is aware of embedded tags. An example is processing a
JSP page, where java is embededd using "<%...%>". After recognizing such a
tag, the associated IDirectTagHandler
is informed to handle the tag.
After handling, the result of the IDirectTagHandler
is streamd as a
replacement for the tag itself. After streaming the processed tag content,
reading the input continues as normal.Modifier and Type | Field and Description |
---|---|
static java.util.Map |
DefaultEscapeMap |
static char |
ESCAPE_CHARACTER |
Constructor and Description |
---|
DirectTagReader(java.io.Reader pReader,
IDirectTagHandler handler,
java.lang.Object context) |
DirectTagReader(java.io.Reader pReader,
IDirectTagHandler handler,
java.lang.Object context,
boolean escape) |
Modifier and Type | Method and Description |
---|---|
protected int |
basicRead()
Read from either the read buffer or the underlying stream.
|
static java.lang.String |
escape(java.lang.String value) |
protected IDirectTagHandler |
getHandler() |
protected boolean |
isSpecialTag(java.lang.String tag) |
int |
read()
Read a character until we encounter a tag.
|
int |
read(char[] cbuf,
int off,
int len) |
protected int |
scanEndTag() |
protected int |
scanTag()
Scan the stream for tagged content.
|
protected int |
scanTagContent()
Scan the content between start and end tag and process the result.
|
void |
setEndTag(java.lang.String tag) |
void |
setStartTag(java.lang.String tag) |
protected int |
tagRead()
Read the underlying stream until the end tag is encountered.
|
protected void |
unread(char[] chars,
int start,
int len) |
protected void |
unread(int c) |
public static final char ESCAPE_CHARACTER
public static final java.util.Map DefaultEscapeMap
public DirectTagReader(java.io.Reader pReader, IDirectTagHandler handler, java.lang.Object context)
public DirectTagReader(java.io.Reader pReader, IDirectTagHandler handler, java.lang.Object context, boolean escape)
public static java.lang.String escape(java.lang.String value)
protected int basicRead() throws java.io.IOException
java.io.IOException
protected IDirectTagHandler getHandler()
protected boolean isSpecialTag(java.lang.String tag)
public int read() throws java.io.IOException
read
in class java.io.FilterReader
java.io.IOException
Reader.read()
public int read(char[] cbuf, int off, int len) throws java.io.IOException
read
in class java.io.FilterReader
java.io.IOException
protected int scanEndTag() throws java.io.IOException
java.io.IOException
protected int scanTag() throws java.io.IOException
java.io.IOException
protected int scanTagContent() throws java.io.IOException
java.io.IOException
public void setEndTag(java.lang.String tag)
public void setStartTag(java.lang.String tag)
protected int tagRead() throws java.io.IOException
java.io.IOException
protected void unread(char[] chars, int start, int len)
protected void unread(int c)