mirror of https://github.com/apache/openjpa.git
OPENJPA-2231 - introduce replace method using Reader for input stream.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1366475 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7b90fd9ed
commit
8c2527215d
|
@ -43,6 +43,11 @@ public class TokenReplacedStream {
|
||||||
* input stream will be replaced by the (i+1)-th String in the output writer.
|
* input stream will be replaced by the (i+1)-th String in the output writer.
|
||||||
*/
|
*/
|
||||||
public void replace(InputStream in, Writer out, String... prs) throws IOException {
|
public void replace(InputStream in, Writer out, String... prs) throws IOException {
|
||||||
|
BufferedReader inRdr = new BufferedReader(new InputStreamReader(in));
|
||||||
|
replace(inRdr, out, prs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replace(Reader in, Writer out, String... prs) throws IOException {
|
||||||
if (prs.length%2 != 0)
|
if (prs.length%2 != 0)
|
||||||
throw new IllegalArgumentException("Even number of pattern/string pairs: " + Arrays.toString(prs)
|
throw new IllegalArgumentException("Even number of pattern/string pairs: " + Arrays.toString(prs)
|
||||||
+ ". Must be even number of arguments.");
|
+ ". Must be even number of arguments.");
|
||||||
|
|
Loading…
Reference in New Issue