Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static File save2File(String savePath, String saveName, String crashReport) { try { File dir = new File(savePath); if (!dir.exists()) dir.mkdir(); File file = new File(dir, saveName); FileOutputStream fos = new FileOutputStream(file); fos.write(crashReport.toString().getBytes()); fos.close(); return file; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } }