Java FileOutputStream Create writeFileFromString(File outputFileName, String content)

Here you can find the source of writeFileFromString(File outputFileName, String content)

Description

ouputs a new file

License

Apache License

Parameter

Parameter Description
outputFileName a parameter
content a parameter

Declaration

public static boolean writeFileFromString(File outputFileName, String content) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    /**/*from ww w  .  j  a v a  2 s .c  o  m*/
     * ouputs a new file
     * @param outputFileName
     * @param content
     * @return
     */
    public static boolean writeFileFromString(File outputFileName, String content) {
        try {

            //File fileName = new File(outputFileName);
            FileOutputStream fos2 = new FileOutputStream(outputFileName, false);

            fos2.write(content.getBytes());

            fos2.close();
        } catch (IOException ioe) {
            return false;
        }
        return true;

    }
}

Related

  1. writeFileCover(String path, String content)
  2. writeFileData(File dataFile, String targetFile)
  3. writeFileData(File file, byte[] fileData)
  4. writeFileFromBytes(byte[] bytes, File file)
  5. writeFileFromStream(File tempFile, InputStream in)
  6. writeFileRaw(String fileName, byte[][] contents)
  7. writeFileToByte(byte[] bytes, File file)
  8. writeFileToDisk(ByteArrayOutputStream is, String savePath)
  9. writeFileToDisk(File file, String targetPath)