Code example for PipedReader

Methods: read

0
        } 
 
        public String read(int nbytes) {
            buf = new char[nbytes];
            try { 
                pr.read(buf, 0, nbytes);
                return new String(buf);
            } catch (IOException e) {
                System.out.println("Exception reading ("
                        + Thread.currentThread().getName() + "): "
                        + e.toString());
                return "ERROR"; 
            } 
        } 
    } 
 
    Thread readerThread;
    PReader reader;
    PipedWriter pw;
    char[] testBuf;