Code example for OutputStreamWriter

Methods: close, write

0
	 * @param text 
	 * @throws IOException 
	 */ 
	public static void rewriteFile(Context context, String path, String text) throws IOException {
		OutputStream os = context.openFileOutput(path, Context.MODE_PRIVATE);
		OutputStreamWriter osw = new OutputStreamWriter(os);
		osw.write(text);
		osw.close();
		os.close();
	} 
 
	/** 
	 * Append text after an existing file 
	 *  
	 * @param file 
	 * @param text 
	 * @throws IOException 
	 */ 
	public static void appendFile(File file, String text) throws IOException {
		FileWriter myFileWriter = new FileWriter(file);
		myFileWriter.append(text);