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
26
27
28
29
30
31
32
|
// This Source Code is in the Public Domain per: http://litesoft.org/License.txt
package org.litesoft.util;
import java.io.*;
import java.util.*;
import org.litesoft.core.util.stringmatching.*;
import org.litesoft.core.util.*;
public class FileUtil
{
public static final String UTF_8 = "UTF-8";
public static BufferedWriter createWriter( File pFile, boolean pAppend )
throws IOException
{
Utils.assertNotNull( "File", pFile );
File zParentFile = pFile.getParentFile();
if ( zParentFile != null )
{
DirectoryUtils.insureDirectory( zParentFile );
}
return new BufferedWriter( new OutputStreamWriter( new FileOutputStream( pFile, pAppend ), UTF_8 ) );
}
public static BufferedReader createReader( File pFile )
throws IOException
{
Utils.assertNotNull( "File", pFile );
return new BufferedReader( new InputStreamReader( new FileInputStream( pFile ), UTF_8 ) );
}
}
|