Here you can find the source of writeStringToFile(File file, String text)
Parameter | Description |
---|---|
file | a parameter |
text | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static void writeStringToFile(File file, String text) throws Exception
//package com.java2s; //License from project: Apache License import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class Main { /**/*w w w . j av a 2 s.c o m*/ * write the given String to a the given file * * @param file * @param text * @throws Exception */ public static void writeStringToFile(File file, String text) throws Exception { Files.write(Paths.get(file.toURI()), text.getBytes()); } }