Write end dead exception using PipedInputStream java
问题 Write end dead exception occurs in the following situation: Two threads: A: PipedOutputStream put = new PipedOutputStream(); String msg = "MESSAGE"; output.wirte(msg.getBytes()); output.flush(); B: PipedInputStream get = new PipedOutputStream(A.put); byte[] get_msg = new byte[1024]; get.read(get_msg); Here is the situation: A and B run concurrently, and A writes to the pipe and B reads it. B just read from the pipe and buffer of this pipe is cleared. Then A doesn't write msg to the pipe in