A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

public abstract int read()
                  throws IOException
This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

如红色部分所示,它所说的流的结束标志是什么?

3 个回复

倒序浏览
-1啊。
字数补丁。
回复 使用道具 举报
FileInputStream.read()如果到达文件末尾,则返回 -1,客户端读到文件结尾的时候,才会向服务端传递结束标志-1! 如果另外的数据没有到达,接收端的read方法会一直等待.
回复 使用道具 举报
应该是-1
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马