Android Text File Write writeFile(String fileName, String content)

Here you can find the source of writeFile(String fileName, String content)

Description

write File

Declaration

public static void writeFile(String fileName, String content) 

Method Source Code

//package com.java2s;

import java.io.FileOutputStream;

public class Main {

    public static void writeFile(String fileName, byte[] content) {

        try {/*from  w ww .  j  av a 2  s.  c  o  m*/
            FileOutputStream fos = new FileOutputStream(fileName);
            fos.write(content);
            fos.flush();
            fos.close();
        } catch (Exception e) {
        }
    }

    public static void writeFile(String fileName, String content) {

        writeFile(fileName, content.getBytes());
    }
}

Related

  1. writeFile(File file, String content, String encoding)
  2. writeFile(File file, String text)
  3. writeFile(File out, String text)
  4. writeFile(OutputStream output, String text)
  5. writeFile(String file, T data, boolean append)
  6. writeFile(String fileName, String text)
  7. writeFile(String fileName, String text, boolean isAppend)
  8. writeFile(String filePath, String content)
  9. writeFileAsString(File file, String text)