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

读写数据

时间:2017-07-13 20:28:26      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:close   gen   void   取数据   read   ring   method   []   txt   

使用fileinputStream 和FileoutputStream读写文件。

public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
//新建一个对象
FileInputStream in =new FileInputStream("E:/java/qwer/qwer.txt");
//
byte[] a =new byte [100];
int i1 =0;
while(i1 != -1){
System.out.print(new String(a,0,100));//a储存读取数据的缓冲区;0数组a的起始偏移量;读取的最大字节数;
i1 = in.read(a);
}

in.close();
}

}

读写数据

标签:close   gen   void   取数据   read   ring   method   []   txt   

原文地址:http://www.cnblogs.com/w7589/p/7162190.html

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