Here you can find the source of saveFileContent(String file, String content, String encode)
Parameter | Description |
---|---|
file | a parameter |
content | a parameter |
encode | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static void saveFileContent(String file, String content, String encode) throws Exception
//package com.java2s; import java.io.FileOutputStream; import java.io.OutputStream; public class Main { /**//from www. j a v a2 s .co m * * @param file * @param content * @param encode * @throws Exception */ public static void saveFileContent(String file, String content, String encode) throws Exception { OutputStream os = null; try { os = new FileOutputStream(file); if (encode != null) { os.write(content.getBytes(encode)); } else { os.write(content.getBytes()); } os.flush(); } catch (Exception e) { throw e; } finally { if (os != null) { os.close(); os = null; } } } }