回顾BufferedInputStream-int read(byte[] buffer)BufferedOutputStream-void write(byte[] buff ,int offset

来源:互联网 发布:阿里云可用区什么意思 编辑:程序博客网 时间:2024/06/05 14:28
学习java基础,是一个反复学习的过程。
今天回顾BufferedInputStreamint read(byte[] buffer) BufferedOutputStreamvoid write(byte[] buff ,int offset ,int len)

int read(byte[] buffer)
参数:
buff,字符流,将字符传入到字符数组当中。一般大小为1k,也就是1024*2byte
返回值:
int类型,读入缓冲区的总字节数,如果因为读到流的末尾而不再有数据可用,则返回-1。

write(byte[] buff ,int offset ,int len)
参数:
buff,从该缓冲区读取数据写入BufferedOutputStream中。
offset,从buff的offset位置读取。
len,要写入的字节数。


使用file.renameTo(File newFile)时
前提是操作file的流需要被关闭。


0 0
原创粉丝点击