<分区>
为什么 InputStream 类的 read() 方法返回 int 而不是 byte?
标签 java
<分区>
为什么 InputStream 类的 read() 方法返回 int 而不是 byte?
最佳答案
如果您阅读 the documentation ,您会看到它解释了原因:
The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned.
关于java - InputStream 类中读取方法的返回类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8459770/