Java之文件流操作的文件读写
本人非常喜欢Java的代码风格,今天记录一下文件字符串的读写,但是Java对于 制作exe文件非常不友好,而本人业务的要求,基本上都是制作exe文件,或者程序,Java在Web方面无疑是非常得力的利器;非常合适不过
package com.sunjun;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.UUID;
public class Dmeo{
public static void main(String[] args) {
String snStr = "1231434";
String strNumber = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
+ "<ns1:TestXMLExport xmlns:" +snStr + "\r\n"
+ "</ns1:TestXMLExport>\r\n" + "";
String fileName = UUID.randomUUID().toString().replace("-", "") + ".xml";
try {
File file = new File("C:\\ITF\\XMLCEXPORT\\" + fileName);
FileOutputStream fos = new FileOutputStream(file);
fos.write(strNumber.getBytes());
fos.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
}