Here you can find the source of writeStringFile(String FileName, String text)
Parameter | Description |
---|---|
Filename | non-null name for the file |
public static void writeStringFile(String FileName, String text)
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { /**/*from w w w. j a v a2s. c o m*/ Write text to a file called Filename @param Filename non-null name for the file @paream text - text as contents - a cr will be added on the end */ public static void writeStringFile(String FileName, String text) { try { FileOutputStream fs = new FileOutputStream(FileName); PrintStream out = new PrintStream(fs); out.println(text); out.close(); } catch (IOException ex) { throw new IllegalArgumentException(ex.toString()); // should not happen } } }