Here you can find the source of getBufferedWriter(String file, String fileCharset)
Parameter | Description |
---|---|
file | String |
fileCharset | String |
Parameter | Description |
---|---|
UnsupportedEncodingException | The exception |
FileNotFoundException | The exception |
private static BufferedWriter getBufferedWriter(String file, String fileCharset) throws UnsupportedEncodingException, FileNotFoundException
//package com.java2s; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; public class Main { /**/*from w w w.jav a 2 s . co m*/ * Get the buffered writer * * @param file String * @param fileCharset String * @return BufferedWriter * @throws UnsupportedEncodingException The exception * @throws FileNotFoundException The exception */ private static BufferedWriter getBufferedWriter(String file, String fileCharset) throws UnsupportedEncodingException, FileNotFoundException { // FIXME move this logic to core module BufferedWriter fs = null; if (fileCharset != null && fileCharset.trim().length() > 0) { fs = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), fileCharset.trim())); } else { fs = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file))); } return fs; } }