|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectariba.util.io.FileHandler
public class FileHandler
This class handles convertions between file byte streams and Unicode character streams, based of a file type. The encoding to be used is determined as follows. [Read] - The encoding passed as an argument, if specified and supported; - The encoding field embedded in the file, if exists and supported; - The encoding set by setSystemDefaultEncoding method, which is done by FileServer typically; - The default encoding of VM [Write] - The encoding passed as an argument, if specified and supported; - The encoding set by setSystemDefaultEncoding method, which is done by FileServer typically; - The default encoding of VM
| Field Summary | |
|---|---|
static String |
CHARSET_8859
|
static String |
CHARSET_CP1252
|
static String |
CHARSET_EUC_JP
|
static String |
CHARSET_JIS
|
static String |
CHARSET_SJIS
|
static String |
NO_ENCODING
|
| Method Summary | |
|---|---|
static String |
getCSVFileEncodingCandidate(String firstLine)
Returns the first column in a comma separeted line that could be an encoding of the CSV file |
static Reader |
getFile(File file,
String encoding)
Returns a Reader associated with a file |
static String |
getFileExtension(File file)
Returns an extension of the file |
static String |
getSystemDefaultEncoding()
Returns system default encoding |
static boolean |
isEncodingSupported(String encoding)
Checks if a specified encoding is supported by VM Typically this is used before saving a file, or for checking whether the first line of a CSV file is encoding information or not. |
static Writer |
putFile(File file,
String encoding)
Returns a Writer associated with a file |
static void |
setSystemDefaultEncoding(String encoding)
Sets system default encoding Basically this is used by FileServer |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CHARSET_8859
public static final String CHARSET_CP1252
public static final String CHARSET_JIS
public static final String CHARSET_SJIS
public static final String CHARSET_EUC_JP
public static final String NO_ENCODING
| Method Detail |
|---|
public static void setSystemDefaultEncoding(String encoding)
encoding - system default encodingpublic static String getSystemDefaultEncoding()
public static boolean isEncodingSupported(String encoding)
encoding - an encoding to be checked
public static Reader getFile(File file,
String encoding)
throws IOException
file - a file to be readencoding - an encoding that will be used
If this is invalid, the encoding in the file
is used if available.
Otherwise the default is used,
depending on the file type
IOException
public static Writer putFile(File file,
String encoding)
throws IOException
file - a file to be writtenencoding - an encoding that will be used
If this is invalid,
the default is used,
depending on the file type
IOExceptionpublic static String getFileExtension(File file)
file - a file to be checkedpublic static String getCSVFileEncodingCandidate(String firstLine)
firstLine - the first line of a CSV file
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||