标签:bcd get bytes java try exce close rgs puts
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class File {
public static void main(String[] args) {
String file = new String ("data.txt");
try {
FileOutputStream out = new FileOutputStream(file);
byte str[] = "12345abcdef@#%&*软件工程".getBytes();
out.write(str);
out.close();
}catch(Exception e) {
e.printStackTrace();
}
try {
FileInputStream in = new FileInputStream(file);
byte yhl[] = new byte[1024];
int mr = in.read(yhl);
System.out.println("文件是: "+new String(yhl,0,mr));
in.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
标签:bcd get bytes java try exce close rgs puts
原文地址:https://www.cnblogs.com/q1525551818/p/11137451.html