Java 8 PipedWriter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PipedWriter class.

This code example shows how to use the following methods: close, write
     * @tests java.io.PipedWriter#write(int) 
     */ 
    public void test_writeI() throws Exception { 
        // Test for method void java.io.PipedWriter.write(int) 
 
        pw = new PipedWriter();
        rdrThread = new Thread(reader = new PReader(pw), "writeI");
        rdrThread.start();
        pw.write(1);
        pw.write(2);
        pw.write(3);
        pw.close();
        rdrThread.join(1000);
        assertTrue("Failed to write correct chars: " + (int) reader.buf[0]
                + " " + (int) reader.buf[1] + " " + (int) reader.buf[2],
                reader.buf[0] == 1 && reader.buf[1] == 2 && reader.buf[2] == 3);
    } 
 
    /** 
     * Tears down the fixture, for example, close a network connection. This 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, write
    } 
 
    public void test_writeI() throws Exception { 
        // Test for method void java.io.PipedWriter.write(int) 
 
        pw = new PipedWriter();
 
        try { 
            pw.write(42);
            fail("Test 1: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
 
        readerThread = new Thread(reader = new PReader(pw), "writeI");
        readerThread.start();
        pw.write(1);
        pw.write(2);
        pw.write(3);
        pw.close();

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, write
     * @tests java.io.PipedWriter#write(int) 
     */ 
    public void test_writeI() throws Exception { 
        // Test for method void java.io.PipedWriter.write(int) 
 
        pw = new PipedWriter();
        rdrThread = new Thread(reader = new PReader(pw), "writeI");
        rdrThread.start();
        pw.write(1);
        pw.write(2);
        pw.write(3);
        pw.close();
        rdrThread.join(1000);
        assertTrue("Failed to write correct chars: " + (int) reader.buf[0]
                + " " + (int) reader.buf[1] + " " + (int) reader.buf[2],
                reader.buf[0] == 1 && reader.buf[1] == 2 && reader.buf[2] == 3);
    } 
 
    /** 
     * Tears down the fixture, for example, close a network connection. This 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: sleep
                System.out.println("Couldn't create writer");
            } 
        } 
 
        public PWriter() { 
            pw = new PipedWriter();
        } 
 
        public void run() { 
            try { 
                char[] c = new char[11];
                "Hello World".getChars(0, 11, c, 0);
                pw.write(c);
                Thread.sleep(10000);
            } catch (InterruptedException e) {
            } catch (Exception e) {
                System.out.println("Exception occurred: " + e.toString());
            } 
        } 
    } 

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        // 获取子记录器的输出源 
        Appender appender = root.getAppender(appenderName); 
        // 定义一个未连接的输入流管道 
        reader = new PipedReader(); 
        // 定义一个已连接的输出流管理,并连接到reader 
        Writer writer = new PipedWriter(reader); 
        // 设置 appender 输出流 
        ((WriterAppender) appender).setWriter(writer); 
    } 
} 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 PipedWriter Methods: