Java I/O
ByteArrayInputStream
is created by passing
it an array. You can then read bytes from it as an
InputStream
.
//This code needs to catch exceptions!!! PipedReader pr = new PipedReader(); PipedWriter pw = null; pw = new PipedWriter(pr); //write pw.write("hello"); //read char [] buffer = new char[1000]; int length = 0; length = pr.read(buffer); String output =new String(buffer, 0, length); System.out.println("String is "); System.out.println(output);
6 of 13