Java FileOutputStream Create writeFile(String p_filename, String p_buffer)

Here you can find the source of writeFile(String p_filename, String p_buffer)

Description

Write a TEXT file

License

Open Source License

Parameter

Parameter Description
p_filename String
p_buffer String

Exception

Parameter Description
IOException an exception

Declaration

public static void writeFile(String p_filename, String p_buffer) throws IOException 

Method Source Code


//package com.java2s;
import java.io.*;

public class Main {
    /**//from w  ww .  ja  v  a2 s . co m
     * Write a TEXT file
     * @param p_filename String
     * @param p_buffer String
     * @throws IOException
     */
    public static void writeFile(String p_filename, String p_buffer) throws IOException {
        FileOutputStream os = null;
        try {
            os = new FileOutputStream(p_filename);
            if (p_buffer != null) {
                os.write(p_buffer.getBytes());
            }
            os.close();
            os = null;
        } finally {
            if (os != null) {
                os.close();
            }
        }
    }
}

Related

  1. writeFile(String fileName)
  2. writeFile(String fileOutput, byte[] data)
  3. writeFile(String filePath, byte[] bytes)
  4. writeFile(String filePath, Object obj)
  5. writeFile(String filePathName, Object obj)
  6. writeFile(String path, byte[] contents)
  7. writeFile(String path, byte[] data)
  8. writeFile(String path, Properties store, String comment)
  9. writeFile(ZipEntry entry, ZipFile zipFile, File file)