JAVA /IO & NIO
PipedOutputStream & InputStream
Safeguard
2013. 3. 3. 01:52
다중 멀티 쓰레드 상태에서의 인아웃 스트림을 연결 시켜주는 스트림
쓰레드간의 스트림을 연결 해야 할때 사용 함 ...
PipedOutputStream
생성자 : 디폴트 생성자 , PipedOutputStream(PipedInputStream)
메소드 : close() , connect(PipedInputStream) < 디폴트 생성시에, 인풋스트림과의 연결을 위한 메소드
flush() , write(byte[] , int , int ) , write();
PipedInputStream
위와 같음
예)
PipedInputStream pis = new PipedInputStream();
PipedOutputStream pos = new PipedOutputStream(pis);
이 상태에서 pis 를 관리하는 클래스를 이용하면, 쓰레드간 스트림 연결이 됨.
즉 인풋스트림을 인자로 받는 생성자는, 파이프아웃풋스트림을 이용해 쓰레드 상황에서도 write가 가능
PiperWrite & Reader 도 마찬가지.