Class LineOrientedInterpolatingReader

java.lang.Object
java.io.Reader
java.io.FilterReader
org.codehaus.plexus.util.LineOrientedInterpolatingReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class LineOrientedInterpolatingReader extends FilterReader
A FilterReader which interpolates keyword values into a character stream. Keywords are recognized when enclosed between starting and ending delimiter strings. The keywords themselves, and their values, are fetched from a Map supplied to the constructor.

When a possible keyword token is recognized (by detecting the starting and ending token delimiters):

  • if the enclosed string is found in the keyword Map, the delimiters and the keyword are effectively replaced by the keyword's value;
  • if the enclosed string is found in the keyword Map, but its value has zero length, then the token (delimiters and keyword) is effectively removed from the character stream;
  • if the enclosed string is not found in the keyword Map, then no substitution is made; the token text is passed through unaltered.

A token in the incoming character stream may be escaped by prepending an "escape sequence" which is specified to the constructor. An escaped token is passed through as written, with the escape sequence removed. This allows things which would look like tokens to be read literally rather than interpolated.

Author:
jdcasey Created on Feb 3, 2005
See Also: