Here you can find the source of writeStringToFile(File pFile, String pString)
Parameter | Description |
---|---|
pFile | file |
pString | string |
Parameter | Description |
---|---|
IOException | if file cannot be writen |
public static final void writeStringToFile(File pFile, String pString) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; import java.io.PrintWriter; public class Main { /**/*from w w w. j a v a2 s . c o m*/ * Writes the content of a string to a file. * * From: * https://stackoverflow.com/questions/1053467/how-do-i-save-a-string-to-a-text-file-using-java * * @param pFile * file * @param pString * string * @throws IOException * if file cannot be writen */ public static final void writeStringToFile(File pFile, String pString) throws IOException { try (PrintWriter out = new PrintWriter(pFile)) { out.print(pString); } } }