I know that java I/O uses decorator pattern. But I feel that I understand its wrong.
Please clarify difference between two code snippets:
You're misusing piped streams. They are intended to be used by a producer thread doing writes and a consumer thread doing reads. See the Javadoc.
The piped streams share a buffer which can fill if the reading thread isn't reading, which stalls your writing thread.
Wrapping streams twice doesn't have anything to do with it, although in this case it is certainly both pointless and problematic.