标签:输出流 输入 fileinput png 记录 bis sts turn 输出
File类
构造函数: FIle file = new File(path);
常用函数:
是否存在: file.exists()
文件名: file.getName()
父目录: file.getParent()
=================================================================
FileInputStream 类
构造方法: InputStream is = new InputStream(File file)
常用方法:
len = is.read(buffer,off,len); ---> len = is.read(buffer);
b the buffer into which the data is read.
@return the total number of bytes read into the buffer, or -1
FileOutputStream 类
构造方法: OutputStream os = new FileOutputStream(File file)
常用方法:
os.write(buffer,0,len)
BufferedInputStream 添加了缓冲区的输入流
构造方法: BufferedInputStream bis = new BufferedInputStream(FileInputStream fis);
常用方法:
bis.read(buffer,0,len);
BufferedOutputStream bos 添加了缓冲区的输出流
构造方法: BufferedOutputStream bos = new BufferedOutputStream(FileOutputStream fos);
常见方法:
bos.write(buffer,0, len);
bos.flush()
bos.close();
标签:输出流 输入 fileinput png 记录 bis sts turn 输出
原文地址:https://www.cnblogs.com/lijins/p/10050780.html