Android Text File Write WriteFile(String file, String message)

Here you can find the source of WriteFile(String file, String message)

Description

Write File

Declaration

public static void WriteFile(String file, String message)
            throws IOException 

Method Source Code

//package com.java2s;

import java.io.*;

public class Main {
    public static void WriteFile(String file, String message)
            throws IOException {
        File f = new File(file);
        if (!f.exists()) {
            f.createNewFile();//from   w ww  .  j av a  2 s.c o  m
        }
        FileOutputStream fout = new FileOutputStream(file);
        byte[] bytes = message.getBytes();
        fout.write(bytes);
        fout.close();
    }
}

Related

  1. writeFileSdcard(File file, String message)
  2. writeFile(String filepath, String text)
  3. writeStringToFile(String text, String filePath)
  4. writeToSDFile(String directory, String file_name, String text)
  5. writeFileEnd(String filepath, String text)
  6. writeNewFile(String filePath, String fileContents)
  7. writeStringToFile(File file, String data)
  8. writeTextFile(File file, String str)
  9. writeTextFile(File file, String[] strArray)