public void MyWriter(String t ,String filepath)//采用的事FileOutputStream写入法
{
FileOutputStream fop = null;
File file;
String content =t;
try
{
file = new File(filepath);
fop = new FileOutputStream(file);
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
// get the content in bytes
byte[] contentInBytes = content.getBytes();
fop.write(contentInBytes);
fop.flush();
fop.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fop != null)
{
fop.close();
}
} catch (IOException e)
{
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载