码迷,mamicode.com
首页 > 其他好文 > 详细

简单I/O

时间:2014-09-11 22:22:42      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:des   io   os   java   c   ad   new   r   file   

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

标签:des   io   os   java   c   ad   new   r   file   

原文地址:http://www.cnblogs.com/gracyandjohn/p/3967264.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!