summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/util/LogPrintWriter.java
blob: 1ec6f02ac9e93b6e2cec885331929d135e11741d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.vaadin.tests.util;

import java.io.PrintWriter;
import java.io.Writer;

/**
 * Use for collecting HTTP response.
 * 
 */
public class LogPrintWriter extends PrintWriter {

    private final StringBuffer result = new StringBuffer(256);

    public LogPrintWriter(Writer out) {
        super(out);
    }

    @Override
    public void print(String s) {
        result.append(s);
        super.print(s);
    }

    @Override
    public void write(String s) {
        result.append(s);
        super.write(s);
    }

    public String getResult() {
        return result.toString();
    }

}