读写数据

使用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();
}

}

posted @ 2017-07-13 19:01  王耀辉1  阅读(120)  评论(0编辑  收藏  举报