Search in sources :

Example 11 with PipedWriter

use of java.io.PipedWriter in project j2objc by google.

the class OldPipedWriterTest method test_close.

public void test_close() throws Exception {
    PipedReader rd = new PipedReader();
    pw = new PipedWriter(rd);
    reader = new PReader(rd);
    try {
        pw.close();
    } catch (IOException e) {
        fail("Test 1: Unexpected IOException: " + e.getMessage());
    }
}
Also used : PipedWriter(java.io.PipedWriter) IOException(java.io.IOException) PipedReader(java.io.PipedReader)

Example 12 with PipedWriter

use of java.io.PipedWriter in project j2objc by google.

the class OldPipedWriterTest method test_writeI.

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();
    reader.read(3);
    assertTrue("Test 2: The charaacters read do not match the characters written: " + (int) reader.buf[0] + " " + (int) reader.buf[1] + " " + (int) reader.buf[2], reader.buf[0] == 1 && reader.buf[1] == 2 && reader.buf[2] == 3);
}
Also used : PipedWriter(java.io.PipedWriter) IOException(java.io.IOException)

Example 13 with PipedWriter

use of java.io.PipedWriter in project j2objc by google.

the class OldPipedWriterTest method test_ConstructorLjava_io_PipedReader.

public void test_ConstructorLjava_io_PipedReader() throws Exception {
    PipedReader rd = new PipedReader();
    try {
        pw = new PipedWriter(rd);
    } catch (Exception e) {
        fail("Test 1: Construtor failed:" + e.getMessage());
    }
    readerThread = new Thread(reader = new PReader(rd), "Constructor(Reader)");
    readerThread.start();
    try {
        pw.write(testBuf);
    } catch (Exception e) {
        fail("Test 2: Could not write to the constructed writer: " + e.getMessage());
    }
    pw.close();
    assertEquals("Test 3: Incorrect character string received.", testString, reader.read(testLength));
    rd = new PipedReader(new PipedWriter());
    try {
        pw = new PipedWriter(rd);
        fail("Test 4: IOException expected because the reader is already connected.");
    } catch (IOException e) {
    // Expected.
    }
}
Also used : PipedWriter(java.io.PipedWriter) IOException(java.io.IOException) PipedReader(java.io.PipedReader) IOException(java.io.IOException)

Example 14 with PipedWriter

use of java.io.PipedWriter in project j2objc by google.

the class InterruptedStreamTest method testInterruptPipedReader.

public void testInterruptPipedReader() throws Exception {
    PipedWriter writer = new PipedWriter();
    PipedReader reader = new PipedReader(writer);
    testInterruptReader(reader);
}
Also used : PipedWriter(java.io.PipedWriter) PipedReader(java.io.PipedReader)

Example 15 with PipedWriter

use of java.io.PipedWriter in project j2objc by google.

the class InterruptedStreamTest method testInterruptPipedWriter.

public void testInterruptPipedWriter() throws Exception {
    final PipedWriter writer = new PipedWriter();
    new PipedReader(writer);
    testInterruptWriter(writer);
}
Also used : PipedWriter(java.io.PipedWriter) PipedReader(java.io.PipedReader)

Aggregations

PipedWriter (java.io.PipedWriter)23 PipedReader (java.io.PipedReader)16 IOException (java.io.IOException)14 Templates (javax.xml.transform.Templates)2 Transformer (javax.xml.transform.Transformer)2 StreamResult (javax.xml.transform.stream.StreamResult)2 BufferedWriter (java.io.BufferedWriter)1 Writer (java.io.Writer)1 ScriptContext (javax.script.ScriptContext)1 JTextArea (javax.swing.JTextArea)1 PipeListener (jmri.util.PipeListener)1 BOSHClientRequestListener (org.igniterealtime.jbosh.BOSHClientRequestListener)1 BOSHClientResponseListener (org.igniterealtime.jbosh.BOSHClientResponseListener)1 BOSHException (org.igniterealtime.jbosh.BOSHException)1 BOSHMessageEvent (org.igniterealtime.jbosh.BOSHMessageEvent)1 SmackException (org.jivesoftware.smack.SmackException)1 ConnectionException (org.jivesoftware.smack.SmackException.ConnectionException)1 NotConnectedException (org.jivesoftware.smack.SmackException.NotConnectedException)1 XMPPException (org.jivesoftware.smack.XMPPException)1 StreamErrorException (org.jivesoftware.smack.XMPPException.StreamErrorException)1