Java FileOutputStream Create writeFileCover(String path, String content)

Here you can find the source of writeFileCover(String path, String content)

Description

write File Cover

License

Open Source License

Declaration

public static void writeFileCover(String path, String content) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

public class Main {

    public static void writeFileCover(String path, String content) throws IOException {
        File file = new File(path);
        if (!file.exists()) {
            file.createNewFile();/*from  w  w  w  .j a  v a2 s .c o  m*/
        }

        FileOutputStream outputStream = new FileOutputStream(file, false);
        outputStream.write(content.getBytes("utf-8"));
        outputStream.close();
    }
}

Related

  1. writeFileByChar(String content, String filename, String encoding)
  2. writeFileByLine(String content, String filename, boolean append)
  3. writeFileBytes(File pFile, byte[] pBytes)
  4. writeFileContent(String filepath, byte[] content)
  5. writeFileContent(String sFileName, byte[] content)
  6. writeFileData(File dataFile, String targetFile)
  7. writeFileData(File file, byte[] fileData)
  8. writeFileFromBytes(byte[] bytes, File file)
  9. writeFileFromStream(File tempFile, InputStream in)