If you look at the documentation for
BufferedInputStream, you will see that a call to read() will block until:
# The specified number of bytes have been read,
# The read method of the underlying stream returns -1, indicating end-of-file, or
# The available method of the underlying stream returns zero, indicating that further input requests would block.