import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class Test1{
public static void main(String[] args) throws Exception{
// int b;
// try {
// System.out.println("please Input:");
// while ((b = System.in.read()) != -1) {
// System.out.print((char)(b));
// }
// } catch (IOException e) {
// System.out.println(e.toString());
//
//byte b[] = s.getBytes();//String转换为byte[]
//String t = new String(b);//bytep[]转换为String
// }
File fin=new File("d:/abc.txt");
File fin2=new File("d:/abcd.txt");
fin2.createNewFile();
FileInputStream in = new FileInputStream( fin);
FileOutputStream out = new FileOutputStream(fin2);
// String content = "zxcvbnm";
//
// byte[] b =content.getBytes();
// out.write(b);
// System.out.print(new String(b));
// out.close();
byte[] b = new byte[100];
in.read(b);
out.write(b);
// System.out.println(new String(b));
in.close();
out.close();
}
}
}
File复制
最新推荐文章于 2024-03-19 15:35:12 发布