Java File Object Create toFile(String content, File output)

Here you can find the source of toFile(String content, File output)

Description

to File

License

Apache License

Declaration

public static void toFile(String content, File output) 

Method Source Code

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

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class Main {
    public static void toFile(String content, File output) {

        try {//w  w  w.  j  a  v a2 s . com
            BufferedWriter writer = new BufferedWriter(new FileWriter(output));
            writer.write(content);
            writer.flush();
            writer.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

Related

  1. toFile(InputStream inputStream)
  2. toFile(JavaFileObject javaFileObject)
  3. toFile(List filenames)
  4. toFile(Map res, String output)
  5. toFile(String base64Code, String targetPath)
  6. toFile(String context, String fileName, boolean append)
  7. toFile(String fileName)
  8. toFile(String fileName, String content)
  9. toFile(String fileName, String cwd)