|
|||||||||
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 java.lang.String |
CHARSET_8859
|
static java.lang.String |
CHARSET_CP1252
|
static java.lang.String |
CHARSET_EUC_JP
|
static java.lang.String |
CHARSET_JIS
|
static java.lang.String |
CHARSET_SJIS
|
static java.lang.String |
NO_ENCODING
|
Method Summary | |
---|---|
static java.lang.String |
getCSVFileEncodingCandidate(java.lang.String firstLine)
Returns the first column in a comma separeted line that could be an encoding of the CSV file |
static java.io.Reader |
getFile(java.io.File file,
java.lang.String encoding)
Returns a Reader associated with a file |
static java.lang.String |
getFileExtension(java.io.File file)
Returns an extension of the file |
static java.lang.String |
getSystemDefaultEncoding()
Returns system default encoding |
static boolean |
isEncodingSupported(java.lang.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 java.io.Writer |
putFile(java.io.File file,
java.lang.String encoding)
Returns a Writer associated with a file |
static void |
setSystemDefaultEncoding(java.lang.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 java.lang.String CHARSET_8859
public static final java.lang.String CHARSET_CP1252
public static final java.lang.String CHARSET_JIS
public static final java.lang.String CHARSET_SJIS
public static final java.lang.String CHARSET_EUC_JP
public static final java.lang.String NO_ENCODING
Method Detail |
---|
public static void setSystemDefaultEncoding(java.lang.String encoding)
encoding
- system default encodingpublic static java.lang.String getSystemDefaultEncoding()
public static boolean isEncodingSupported(java.lang.String encoding)
encoding
- an encoding to be checkedpublic static java.io.Reader getFile(java.io.File file, java.lang.String encoding) throws java.io.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
java.io.IOException
public static java.io.Writer putFile(java.io.File file, java.lang.String encoding) throws java.io.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
java.io.IOException
public static java.lang.String getFileExtension(java.io.File file)
file
- a file to be checkedpublic static java.lang.String getCSVFileEncodingCandidate(java.lang.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 |