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());
}
}
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);
}
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.
}
}
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);
}
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);
}
Aggregations