Class StreamSubstituter
- java.lang.Object
-
- com.sun.identity.authentication.service.StreamSubstituter
-
public class StreamSubstituter extends Object
Copies a Reader to a Writer performing string substitution.
-
-
Constructor Summary
Constructors Constructor Description StreamSubstituter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefine(String key, String val)Define a string to substitute.voidfilter(File inputFile, PrintWriter o)Filters data from file.StringBuffergetFileContents(File filename)Get file content from file to string buffer
-
-
-
Method Detail
-
define
public void define(String key, String val)
Define a string to substitute. In the content being filtered, all occurrences of ...<subst data="key">otherwise</subst>will be replaced with the value defined for "key". If the key has not been defined, then "otherwise" will be copied to the output stream. More than onedate="key"may be specified in the same <subst> tag in which case they are substituted in order, and "otherwise" is only copied if none of the keys were found.- Parameters:
key- file name used as key for cacheval- string value for representation of the file
-
filter
public void filter(File inputFile, PrintWriter o) throws IOException
Filters data from file.- Parameters:
inputFile- that filter will be applied.o- output stream filtered content will be written.- Throws:
IOException- if content can not be read from
-
getFileContents
public StringBuffer getFileContents(File filename) throws Exception
Get file content from file to string buffer- Parameters:
filename- will be read from- Returns:
- StringBuffer representation of file content
- Throws:
Exception- if file can not be read from.
-
-