首页 > 代码库 > 简单I/O
简单I/O
OutputStream,InputStream,FileOutputStream,FileInputStream.
fis = new FileInputStream("C:/Desktop/from.txt");
fos = new FileOutputStream("C:/Desktop/to.txt");
int read(byte[],int offset,int length).返回值为字节流的长度
int temp=read(byte[],int offset,int length);
void write(byte[],int offset,temp);
第一步:导入类,import java.io.*
第二步:声明输入流/输出流引用
FileInputStream fis=null;
FileOutputStream fos=null;
第三步:生成代表输入流或输出流的对象
fis = new FileInputStream("C:/Desktop/from.txt");
fos = new FileOutputStream("C:/Desktop/to.txt");
第四步:生成一个字节数组
byte [] buffer=new byte[100];
简单I/O
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。