Code example for PipedInputStream

Methods: read

0
        } 
 
        public String read(int nbytes) {
            byte[] buf = new byte[nbytes];
            try { 
                reader.read(buf, 0, nbytes);
                return new String(buf, "UTF-8");
            } catch (IOException e) {
                System.out.println("Exception reading info");
                return "ERROR"; 
            } 
        } 
    } 
 
    Thread rt;
 
    PReader reader;
 
    PipedOutputStream out;