Java Text File Write nio write(String location, String content)

Here you can find the source of write(String location, String content)

Description

write

License

Apache License

Declaration

public static File write(String location, String content) throws IOException 

Method Source Code

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

import com.google.common.io.Files;
import java.io.File;

import java.io.IOException;
import java.nio.charset.Charset;

public class Main {

    public static File write(String location, String content) throws IOException {
        File file = new File(location);

        file.getParentFile().mkdirs();/*from w w w .  j a va 2  s .com*/
        Files.write(content, file, Charset.defaultCharset());

        return file;
    }
}

Related

  1. write(final Object o, final String filename)
  2. write(final OutputStream outputStream, final String string)
  3. write(final StringBuffer data, final Writer output)
  4. write(OutputStream stream, String string)
  5. write(String content, String file)
  6. write(String msg)
  7. writeAllLines(File file, List list)
  8. writeAllText(File file, String contents)
  9. writeArray2File(File file, Object[] objects, String code)