Java Text File Write writeStringToFile(String path, String content)

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

Description

write String To File

License

Apache License

Parameter

Parameter Description
path a parameter
content a parameter

Exception

Parameter Description
IOException an exception

Declaration

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

Method Source Code


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

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

import java.io.IOException;

public class Main {
    /**//w  w w. jav a  2  s.c o m
     * 
     * @param path
     * @param content
     * @throws IOException
     */
    public static void writeStringToFile(String path, String content) throws IOException {
        File f = new File(path);
        FileOutputStream out = new FileOutputStream(f);
        out.write(content.getBytes());
        out.close();
    }
}

Related

  1. writeStringToFile(String fullPath, byte[] fileBytes)
  2. writeStringToFile(String fullPath, String content)
  3. writeStringToFile(String jsonStr, File file)
  4. writeStringToFile(String macroContent, File file)
  5. writeStringToFile(String modifiedLine, String filePath)
  6. writeStringToFile(String path, String content)
  7. writeStringToFile(String path, String content)
  8. writeStringToFile(String path, String contents)
  9. writeStringToFile(String s, File f)