File(“e:/1.xml”, content);
//System.out.println(sb);
} catch (Exception e)
{
e.printStackTrace();
}
} else
{
System.out.println(“文件不存在!”);
}
}
public static void writeFile(String filePathAndName, String fileContent)
{
try
{
File f = new File(filePathAndName);
if (!f.exists())
{
f.createNewFile();
}
OutputStreamWriter write = new OutputStreamWriter(
new FileOutputStream(f), “UTF-8”);
BufferedWriter writer = new BufferedWriter(write);
writer.write(fileContent);
writer.close();
}
catch (Exception e)
{
System.out.println(“写文件内容操作出错”);
e.printStackTrace();
}
}
java 读写文件
更多免费相关学习经验请访问:Tore_m_1206686_21115_1_1.html”>http://www.shangxueba.com/sTore_m_1206686_21115_1_1.html
擒龙要下海,打虎要上山。