Java Code Examples for java.io.PrintWriter.toString()

The following are Jave code examples for showing how to use toString() of the java.io.PrintWriter class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: openjdk-jdk10   File: DocCommentTreeApiTester.java   View Source Code Vote up 7 votes
String getExpected(List<String> lines) {
    boolean start = false;
    StringWriter sw = new StringWriter();
    PrintWriter out = new PrintWriter(sw);
    for (String line : lines) {
        if (!start) {
            start = line.startsWith(MARKER_START);
            continue;
        }
        if (line.startsWith(MARKER_END)) {
            out.flush();
            return sw.toString();
        }
        out.println(line);
    }
    return out.toString() + "Warning: html comment end not found";
}