字节流读取数据

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {
public static void main(String[] args) throws IOException {

FileInputStream fileInputStream = new FileInputStream("E:\\itcast\\javaee\\5929.txt");
FileOutputStream fileOutputStream = new FileOutputStream("C:\\Users\\31339\\Desktop\\新建文件夹 (7)\\fileinput\\ithaeima");

byte[] b = new byte[1024];
int m;
while ((m = fileInputStream.read(b)) != -1) {
System.out.println(new String(b, 0, m));
}


fileOutputStream.close();
fileInputStream.close();
}
}
posted @ 2024-03-22 20:28  想不起来好名字  阅读(6)  评论(0)    收藏  举报