GNU header update.
[cacao.git] / tests / kaffe / PipeTest.java
1 /**
2  * Test case for PR#690.
3  * The read method of java.io.PipedInputStream has no 'early out'.
4  *
5  * @author Win van Velthoven <ftu@fi.uu.nl>
6  */
7 import java.io.*;
8 class PipeTest extends Thread
9 {
10         PipedInputStream in;
11         PipedOutputStream out;
12
13         InputStreamReader isr;
14         OutputStreamWriter osw;
15
16         BufferedReader br;
17         PrintWriter pw;
18
19         PipeTest() throws IOException
20         {
21                 in = new PipedInputStream();
22                 isr = new InputStreamReader(in);
23                 br  = new BufferedReader(isr);
24                 out = new PipedOutputStream(in);
25                 osw = new OutputStreamWriter(out);
26                 pw  = new PrintWriter(osw,true);
27         }
28
29         public void run()
30         {
31            try
32            {
33                 String line = br.readLine();
34                 System.out.println(line);
35            } catch(IOException _) {}
36         }
37
38         public static void main(String[] args)  throws IOException
39         {
40            PipeTest t = new PipeTest();
41            t.start();
42            t.pw.println("PipeTest");
43         }
44 }
45 /* Expected Output:
46 PipeTest
47 */