For using the non-blocking streams you should use NIO Java API, it
uses channels(non-blocking) rather than streams(blocking) for reading
and writing bytes.
IO API uses streams for both read and write operations , the
particular thread that is going to read will be block till the data is
available. this is the concept of blocking streams
but NIO API uses Channels , which reads bytes asynchrounously means
non-blocking mode.