Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; public class Main { public static boolean write2SDFromString(String path, String fileName, String input) { boolean flag = true; File file = null; OutputStream output = null; try { file = new File(path + fileName); file.createNewFile(); // creatSDDir(path); //file = creatSDFile(path + fileName); output = new FileOutputStream(file); byte buffer[] = input.getBytes(); output.write(buffer, 0, buffer.length); output.flush(); } catch (Exception e) { return false; } finally { try { output.close(); } catch (Exception e) { return flag; } } return flag; } }