litesoft
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt
package org.litesoft.util;
import java.io.*;
import org.litesoft.core.typeutils.*;
public class FileUtil
{
public static final String UTF_8 = "UTF-8";
public static BufferedWriter createWriter( File pFile, boolean pAppend )
throws IOException
{
Objects.assertNotNull( "File", pFile );
return new BufferedWriter( new OutputStreamWriter( new FileOutputStream( DirectoryUtils.insureParentDirectory( pFile ), pAppend ), UTF_8 ) );
}
public static BufferedReader createReader( File pFile )
throws IOException
{
Objects.assertNotNull( "File", pFile );
return new BufferedReader( new InputStreamReader( new FileInputStream( pFile ), UTF_8 ) );
}
}
|