Why don't write array of characters in a BufferedOutputStream using Piped?
posted 13 years ago
This morning I programed one program this code in one program, but when I compile the program, It was stoped in the "bOut.write(....)" line, It wasn't finish the program. Please, why don't found this code?? here It's the code.
Typically, data is written to a PipedOutputStream object by one thread and data is read from the connected PipedInputStream by some other thread. Attempting to use both objects from a single thread is not recommended as it may deadlock the thread.
The problem is, most likely, that your PipedOutputStream's internal buffer is full, because you're writing to the output stream, but no one is reading from the input stream. Eventually the system decides it's had enough, and blocks until you read. Which will never happen here, because you haven't created a separate thread to read from the input stream.