This is a misuse of piped streams. They are intended to be used by different threads. They will not work as you are using them here, because there is a 4k buffer and the writer blocks when it fills. From the Javadoc:
Attempting to use both objects from a single thread is not recommended, as it may deadlock the thread.
Personally I have never encountered a valid use for these piped streams since May 1997. I used one once back then and took it out immediately in favour of a queue.