Search in sources :

Example 41 with CharArrayWriter

use of java.io.CharArrayWriter in project android_frameworks_base by AOSPA.

the class VolumeInfo method toString.

@Override
public String toString() {
    final CharArrayWriter writer = new CharArrayWriter();
    dump(new IndentingPrintWriter(writer, "    ", 80));
    return writer.toString();
}
Also used : CharArrayWriter(java.io.CharArrayWriter) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 42 with CharArrayWriter

use of java.io.CharArrayWriter in project android_frameworks_base by AOSPA.

the class StorageVolume method dump.

/** {@hide} */
// TODO(b/26742218): find out where toString() is called internally and replace these calls by
// dump().
public String dump() {
    final CharArrayWriter writer = new CharArrayWriter();
    dump(new IndentingPrintWriter(writer, "    ", 80));
    return writer.toString();
}
Also used : CharArrayWriter(java.io.CharArrayWriter) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 43 with CharArrayWriter

use of java.io.CharArrayWriter in project android_frameworks_base by AOSPA.

the class DiskInfo method toString.

@Override
public String toString() {
    final CharArrayWriter writer = new CharArrayWriter();
    dump(new IndentingPrintWriter(writer, "    ", 80));
    return writer.toString();
}
Also used : CharArrayWriter(java.io.CharArrayWriter) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 44 with CharArrayWriter

use of java.io.CharArrayWriter in project android_frameworks_base by AOSPA.

the class NetworkStatsHistory method toString.

@Override
public String toString() {
    final CharArrayWriter writer = new CharArrayWriter();
    dump(new IndentingPrintWriter(writer, "  "), false);
    return writer.toString();
}
Also used : CharArrayWriter(java.io.CharArrayWriter) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 45 with CharArrayWriter

use of java.io.CharArrayWriter in project jdk8u_jdk by JetBrains.

the class bug8005391 method main.

public static void main(String[] args) throws Exception {
    int N = 10;
    for (int i = 0; i < N; i++) {
        HTMLEditorKit kit = new HTMLEditorKit();
        Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator");
        HTMLEditorKit.Parser parser = (HTMLEditorKit.Parser) c.newInstance();
        HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
        HTMLEditorKit.ParserCallback htmlReader = doc.getReader(0);
        parser.parse(new CharArrayReader(htmlDoc.toCharArray()), htmlReader, true);
        htmlReader.flush();
        CharArrayWriter writer = new CharArrayWriter(1000);
        kit.write(writer, doc, 0, doc.getLength());
        writer.flush();
        String result = writer.toString();
        if (!result.contains("<tt><a")) {
            throw new RuntimeException("The <a> and <tt> tags are swapped");
        }
    }
}
Also used : CharArrayReader(java.io.CharArrayReader) HTMLDocument(javax.swing.text.html.HTMLDocument) HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) CharArrayWriter(java.io.CharArrayWriter)

Aggregations

CharArrayWriter (java.io.CharArrayWriter)211 PrintWriter (java.io.PrintWriter)51 IOException (java.io.IOException)39 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)21 Test (org.junit.Test)11 InputStreamReader (java.io.InputStreamReader)9 Map (java.util.Map)9 BufferedReader (java.io.BufferedReader)8 File (java.io.File)8 ArrayList (java.util.ArrayList)8 TitledBorder (javax.swing.border.TitledBorder)8 EdgeListGraph (edu.cmu.tetrad.graph.EdgeListGraph)7 Graph (edu.cmu.tetrad.graph.Graph)7 Writable (groovy.lang.Writable)7 CharArrayReader (java.io.CharArrayReader)7 Reader (java.io.Reader)7 Date (java.util.Date)7 InputStream (java.io.InputStream)6 StringReader (java.io.StringReader)6 IKnowledge (edu.cmu.tetrad.data.IKnowledge)5