when does FileInputStream.read() block?
问题 The question is similar to the following two questions. Java InputStream blocking read Why is the FileInputStream read() not blocking? But I still cannot fully understand it. So far I think the read() method in following code will block due to the empty file 'test.txt'. FileInputStream fis = new FileInputStream("c:/test.txt"); System.out.println(fis.read()); System.out.println("to the end"); Actually it will print -1, I want to know why. The javadoc says This method blocks if no input is yet