1 | private BufferedReader createBufferedReader(FileEntry fileEntry, String filename) throws IOException { ↵ | | 1 | private BufferedWriter createBufferedWriter(FileEntry fileEntry, String filename) throws IOException { ↵
|
2 | FileInputStream fis = new FileInputStream(fileEntry.file); ↵ | | 2 | FileOutputStream fos = new FileOutputStream(fileEntry.file); ↵
|
3 | InputStreamReader isr = null;↵ | | 3 | OutputStreamWriter osw = null;↵
|
4 | // If file encoding is specified, read using that encoding, otherwise use default platform encoding↵ | | 4 | // If file encoding is specified, write using that encoding, otherwise use default platform encoding↵
|
5 | String charsetName = fileEntry.charSetEncoding;↵ | | 5 | String charsetName = fileEntry.charSetEncoding;↵
|
6 | if(charsetName != null && charsetName.trim().length() > 0) {↵ | | 6 | if(charsetName != null && charsetName.trim().length() > 0) {↵
|
7 | isr = new InputStreamReader(fis, charsetName); ↵ | | 7 | osw = new OutputStreamWriter(fos, charsetName); ↵
|
8 | } else {↵ | | 8 | } else {↵
|
9 | isr = new InputStreamReader(fis); ↵ | | 9 | osw = new OutputStreamWriter(fos); ↵
|
10 | }↵ | | 10 | }↵
|
11 | return new BufferedReader(isr);↵ | | 11 | return new BufferedWriter(osw);↵
|
12 | | | 12 |
|