Here you can find the source of Write(String fileName, String message)
public static void Write(String fileName, String message)
//package com.java2s; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.net.MalformedURLException; public class Main { public static void Write(String fileName, String message) { try {// w w w . j a v a2 s . c o m FileOutputStream outSTr = null; try { outSTr = new FileOutputStream(new File(fileName)); } catch (FileNotFoundException e) { e.printStackTrace(); } BufferedOutputStream Buff = new BufferedOutputStream(outSTr); byte[] bs = message.getBytes(); Buff.write(bs); Buff.flush(); Buff.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }