ecco qui un esempio dal mio libro:
codice:
import java.io.*;

public class PipedIOSample extends Thread{
	static PipedInputStream iStream = new PipedInputStream();

	


	public void run(){
		try {
			String str;
			while (true) {
				str = iStream.read([oStream]);
				System.out.println("letta: _" + str);
			}
		}
		catch(IOException e) {
			e.printStackTrace();
		}
	}

	public static void main (String args[]) throws IOException {
		
		PipedOutputStream oStream = new PipedOututStream(iStream);

		(new PipedIOSample()).start();

		for (int i=0; i< args.length; i++) {
			System.out.println("Scrivo: _" + args[i]);
			oStream.write(args[i]);
		
		}
		
		oStream.close();
	}
}

e unaltro:
codice:
import java.io.*;

public class Read {

 _ _public static void main(String args[]) throws Exception {
 _ _ _ _byte[] b = {1, 2, 3, 4, 5};
 _ _ _ _PipedOutputStream poStream = new PipedOutputStream();
 _ _ _ _PipedInputStream piStream = new PipedInputStream();

 _ _ _ _//piped input stream connect to the piped output stream 
 _ _ _ _piStream.connect(poStream);

 _ _ _ _//Writes specified byte array.
 _ _ _ _poStream.write(b, 0, 5);

 _ _ _ _//Reads the next byte of data from this piped input stream.
 _ _ _ _for (int i = 0; i < b.length; i++) {
 _ _ _ _ _ _System.out.println(piStream.read());
 _ _ _ _}

 _ _ _ _// Closes piped input stream
 _ _ _ _poStream.close();

 _ _ _ _// Closes piped output stream
 _ _ _ _piStream.close();
 _ _}
}
adesso la domanda. perchè nel primo è stato utilizzato Data[Input][Output]Stream e nel secondo no?
se si può saltare perchè non farlo?


grazie per le risposte, non trovo l'utilità di queste classi se non strettamente necessarie