readFully(byte[] b)是自适应解决读取流中多少字节问题的(当然由参数byte个数决定),有则读满,流结尾时则自动退出阻塞,详细见JDK帮助
2012-10-05 18:07
363 查看
readFully
public void readFully(byte[] b) throws IOException
Reads some bytes from an input stream and stores them into the buffer array
b. The number of bytes read is equal to the length of
b.
This method blocks until one of the following conditions occurs:
b.lengthbytes of input data are available, in which case a normal return is made.
End of file is detected, in which case an
EOFExceptionis thrown.
An I/O error occurs, in which case an
IOExceptionother than
EOFExceptionis thrown.
If
bis
null, a
NullPointerExceptionis thrown. If
b.lengthis zero, then no bytes are read. Otherwise, the first byte read is stored into element
b[0], the next one into
b[1], and so on. If an exception is thrown from this method, then it may be that some but not all bytes of
bhave been updated with data from the input stream.
Parameters:
b- the buffer into which the data is read. Throws:
EOFException- if this stream reaches the end before reading all the bytes.
IOException- if an I/O error occurs.
还有一点参数off要注意:off是表示目的字节数组的起始位置的偏移量
void | , int, int)]readFully(byte[] b, int off, int len) 從串流中讀取 len個位元組,並將其存儲到 b中(從索引 off開始)。 |
相关文章推荐
- 解决eclipse自动生成参数为arg0,arg1问题
- 解决unbuntu14.04上的eclipse自动退出的问题
- vc屏蔽回车键解决自动退出程序问题
- DBImport V3.7版本发布及软件稳定性(自动退出问题)解决过程分享
- DBImport V3.7版本发布及软件稳定性(自动退出问题)解决过程分享
- 解决unbuntu14.04上的eclipse自动退出的问题
- ubuntu linux qq自动退出关闭的问题解决方法
- MyEclipse 9.1 在windows ,Linux ,MacOSX的破解,并解决myeclipse 9.1 在Linux自动退出问题
- android eclipse 解决使用布局查看器自动退出 的问题
- 解决ecshop因为动态ip问题登录后台自动退出
- 解决ajax autocomplete自动完成功能,传参数问题
- docker run java官方镜像默认自动退出的问题解决办法
- inputStream.read(byte[] )死循环、阻塞问题 3ff8
- 比较详细的win2003 IIS6.0 301重定向带参数的问题解决方法
- JDK1.8 StampedLock: 解决ReentrantReadWriteLock在读多写少情况下,写线程饥饿问题
- fedora 12下qq自动退出问题解决方法
- 解决用户退出登录不会自动跳转到登录页面的问题
- 解决maven项目自动修改jdk版本问题
- win2003远程退出后系统自动注销问题的解决方法
- 解决eclipse自动生成参数为arg0,arg1问题