Here you can find the source of saveFile(File file, String data)
Parameter | Description |
---|---|
file | The location to save the String. |
data | The String data to save. |
Parameter | Description |
---|---|
IOException | an exception |
public static final void saveFile(File file, String data) throws IOException
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.io.File; import java.io.FileWriter; import java.io.IOException; public class Main { /**//www. ja v a 2s .co m * Saves the String data to the File. * * @param file The location to save the String. * @param data The String data to save. * @throws IOException */ public static final void saveFile(File file, String data) throws IOException { FileWriter writer = null; try { writer = new FileWriter(file); writer.write(data); } catch (IOException e) { throw e; } finally { writer.close(); } } }