コード例 #1
0
 /** java.io.PipedOutputStream#write(int) */
 public void test_writeI() throws IOException {
   out = new PipedOutputStream();
   rt = new Thread(reader = new PReader(out));
   rt.start();
   out.write('c');
   out.flush();
   assertEquals("Wrote incorrect byte", "c", reader.read(1));
 }
コード例 #2
0
 /** java.io.PipedOutputStream#write(byte[], int, int) */
 public void test_write$BII() throws IOException, UnsupportedEncodingException {
   out = new PipedOutputStream();
   rt = new Thread(reader = new PReader(out));
   rt.start();
   out.write("HelloWorld".getBytes("UTF-8"), 0, 10);
   out.flush();
   assertEquals("Wrote incorrect bytes", "HelloWorld", reader.read(10));
 }