class="java" name="code"> File file = new File("d:/Data.txt"); if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); return; } } OutputStreamWriter os = null; try { os = new OutputStreamWriter(new FileOutputStream(file, true)); for (String key : map.keySet()) { String property = map.get(key); os.write(property); os.write("\t"); os.write(key); os.write("\r\n"); } os.write("=========="); os.write("\r\n"); os.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { os.close(); } catch (IOException e) { e.printStackTrace(); } } }