Java Path File Content writeFile(String path, String content)

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

Description

write File

License

Open Source License

Declaration

public static void writeFile(String path, String content)
            throws FileNotFoundException, IOException 

Method Source Code

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

import java.io.File;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import java.nio.channels.FileChannel;

public class Main {
    public static void writeFile(String path, String content)
            throws FileNotFoundException, IOException {
        FileOutputStream stream = new FileOutputStream(new File(path));
        try {//from w  ww . j a v  a 2s .c om
            FileChannel fc = stream.getChannel();
            stream.write(content.getBytes());
        } finally {
            stream.close();
        }
    }
}

Related

  1. writeFile(final String content, final String path)
  2. writeFile(Path file, String content)
  3. writeFile(Path filePath, String content)
  4. writeFile(Path path, String content)
  5. writeFile(Path path, String contents)
  6. writeFile(String path, String content)
  7. writeFile(String path, String contents)
  8. writeFileContents(Path to, byte[] contents)
  9. writeJsonToFile(Path jsonPath, String jsonContent)