字节的读取和写入
package IO流.demo1;
import java.io.*;
public class Demo2 {
public static void main(String[] args) {
FileInputStream fis = null;
FileOutputStream fio= null;
{
try {
fis = new FileInputStream(“C:\Users\hyn\Desktop\壁纸\成果.jpg”);
fio= new FileOutputStream(“C:\Users\hyn\Desktop\学习用品\1.jpg”);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
byte [] b=new byte[1024];
int n=0;
while (true){
try {
if (!((n=fis.read(b))!=-1))
fio.write(b,0,n);
break;
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}