Here you can find the source of serialize(final File folder, final String content, final String fileName)
Parameter | Description |
---|---|
folder | File |
content | String |
fileName | String |
public static void serialize(final File folder, final String content, final String fileName) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { /**//from w w w . j a v a 2 s . c o m * Serialize a content into a targeted file, checking that the parent directory exists. * * @param folder File * @param content String * @param fileName String */ public static void serialize(final File folder, final String content, final String fileName) throws IOException { if (!folder.exists()) { folder.mkdirs(); } final File output = new File(folder, fileName); FileWriter writer = null; try { writer = new FileWriter(output); writer.write(content); writer.flush(); } catch (Exception e) { throw new IOException("Failed to serialize the notification in folder " + folder.getPath(), e); } finally { if (writer != null) { writer.close(); } } } }