Here you can find the source of writeString(final String output, final String fileName)
Parameter | Description |
---|---|
output | String content of the file |
fileName | full path of the file |
Parameter | Description |
---|---|
FileNotFoundException | if the file path cannot be found. |
UnsupportedEncodingException | an exception |
public static void writeString(final String output, final String fileName) throws FileNotFoundException, UnsupportedEncodingException
//package com.java2s; //License from project: Open Source License import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; public class Main { /**/*from w w w . j ava2 s . c om*/ * Writes string to file * * @param output String content of the file * @param fileName full path of the file * @throws FileNotFoundException if the file path cannot be found. * @throws UnsupportedEncodingException */ public static void writeString(final String output, final String fileName) throws FileNotFoundException, UnsupportedEncodingException { PrintWriter out = new PrintWriter(fileName, "US-ASCII"); out.print(output); out.close(); } }