rendsite.tools
Class EscapeReader

java.lang.Object
  extended by java.io.Reader
      extended by rendsite.tools.EscapeReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable

public class EscapeReader
extends java.io.Reader

This is an escaping reader. When it finds an escape sequence, it'll ask what to put in its place.

Author:
erich Version History
 10NOV09 - EPG - First package release.
 

Field Summary
static java.lang.String ESCAPE_CLOSE
           
static char ESCAPE_CLOSE_0
           
static char ESCAPE_CLOSE_1
           
static char ESCAPE_CLOSE_2
           
static char ESCAPE_CLOSE_3
           
static java.lang.String ESCAPE_OPEN
           
static char ESCAPE_OPEN_0
           
static char ESCAPE_OPEN_1
           
static char ESCAPE_OPEN_2
           
static char ESCAPE_OPEN_3
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
EscapeReader(java.io.Reader source, things.data.ThingsPropertyViewReader properties)
          Construct the stream.
 
Method Summary
 void close()
           
 boolean markSupported()
           
static java.lang.String process(java.lang.String input, things.data.ThingsPropertyViewReader properties)
          Process a single string.
 int read()
          Read implementation.
 int read(char[] cbuf, int off, int len)
          Reads characters into a portion of an array.
 
Methods inherited from class java.io.Reader
mark, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ESCAPE_OPEN

public static final java.lang.String ESCAPE_OPEN
See Also:
Constant Field Values

ESCAPE_OPEN_0

public static final char ESCAPE_OPEN_0
See Also:
Constant Field Values

ESCAPE_OPEN_1

public static final char ESCAPE_OPEN_1
See Also:
Constant Field Values

ESCAPE_OPEN_2

public static final char ESCAPE_OPEN_2
See Also:
Constant Field Values

ESCAPE_OPEN_3

public static final char ESCAPE_OPEN_3
See Also:
Constant Field Values

ESCAPE_CLOSE

public static final java.lang.String ESCAPE_CLOSE
See Also:
Constant Field Values

ESCAPE_CLOSE_0

public static final char ESCAPE_CLOSE_0
See Also:
Constant Field Values

ESCAPE_CLOSE_1

public static final char ESCAPE_CLOSE_1
See Also:
Constant Field Values

ESCAPE_CLOSE_2

public static final char ESCAPE_CLOSE_2
See Also:
Constant Field Values

ESCAPE_CLOSE_3

public static final char ESCAPE_CLOSE_3
See Also:
Constant Field Values
Constructor Detail

EscapeReader

public EscapeReader(java.io.Reader source,
                    things.data.ThingsPropertyViewReader properties)
Construct the stream.

Parameters:
source - the source stream
properties - the replacement properties.
Method Detail

read

public int read()
         throws java.io.IOException
Read implementation.

Overrides:
read in class java.io.Reader
Throws:
java.io.IOException

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Reads characters into a portion of an array. This method will block until some input is available, an I/O error occurs, or the end of the stream is reached.

Specified by:
read in class java.io.Reader
Parameters:
cbuf - Destination buffer
off - Offset at which to start storing characters
len - Maximum number of characters to read
Returns:
The number of characters read, or -1 if the end of the stream has been reached
Throws:
java.io.IOException - If an I/O error occurs

markSupported

public boolean markSupported()
Overrides:
markSupported in class java.io.Reader

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException

process

public static java.lang.String process(java.lang.String input,
                                       things.data.ThingsPropertyViewReader properties)
                                throws java.lang.Throwable
Process a single string.

Parameters:
input - a string to process.
properties - properties for replacement.
Throws:
java.lang.Throwable - Dangling escapes will NOT cause exceptions.


rendsite.