获取系统临时文件目录,生成txt文件

        BufferedWriter bw =  null;
        StringBuilder sb = new StringBuilder();
		sb.append("a").append("\n");
		sb.append("b");
				try {
					File file = new File(path, "TestCar.txt");
					if (!file.exists()) {
						file.createNewFile();
					}
					bw = new BufferedWriter(new OutputStreamWriter(
							new FileOutputStream(file), "GBK"));
					bw.write(sb.toString());
				} catch (Exception e2) {
					e2.printStackTrace();
				} finally {
					if (bw != null) {
						try {
							bw.flush();
							bw.close();
						} catch (Exception e3) {
							e3.printStackTrace();
						}
					}
				}

上一篇:【网络编程】


下一篇:十六、网络编程