Class TokenReplacedStream


  • public class TokenReplacedStream
    extends java.lang.Object
    Reads from an input stream and writes to an output stream after replacing matched tokens by their counterpart.
    Author:
    Pinaki Poddar
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void replace​(java.io.InputStream in, java.io.Writer out, java.lang.String... prs)
      Read the given input stream and replaces the tokens as it reads.
      void replace​(java.io.Reader in, java.io.Writer out, java.lang.String... prs)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TokenReplacedStream

        public TokenReplacedStream()
    • Method Detail

      • replace

        public void replace​(java.io.InputStream in,
                            java.io.Writer out,
                            java.lang.String... prs)
                     throws java.io.IOException
        Read the given input stream and replaces the tokens as it reads. The replaced stream is written to the given output stream.
        Parameters:
        in - a non-null input stream
        out - a character oriented writer
        replacements - an even number of Strings. Any occurrence of the even-indexed i-th String in the input stream will be replaced by the (i+1)-th String in the output writer.
        Throws:
        java.io.IOException
      • replace

        public void replace​(java.io.Reader in,
                            java.io.Writer out,
                            java.lang.String... prs)
                     throws java.io.IOException
        Throws:
        java.io.IOException