org.eclipse.rse.services.clientserver
Class SystemEncodingUtil
java.lang.Object
org.eclipse.rse.services.clientserver.SystemEncodingUtil
-
public class SystemEncodingUtil
- extends
Object
A singleton class that contains useful methods related to encodings.
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
ENCODING_UTF_8
public static
String ENCODING_UTF_8
getInstance
public static
SystemEncodingUtil getInstance()
- Returns the singleton instance of the utility class.
-
-
Returns:
- the singleton instance.
setDefaultEncodingProvider
public void setDefaultEncodingProvider(
SystemEncodingUtil.DefaultEncodingProvider p)
- Change the default encoding provider.
This is a system-wide change, and clients will not be notified of changed
default encodings due to changing the provider. Therefore, changing the
provider should be done only once during early system startup.
-
-
Parameters:
-
p
- the new encoding provider. -
Since:
- 3.0
getLocalDefaultEncoding
public
String getLocalDefaultEncoding()
- Returns the local default encoding as provided by the default encoding
provider. This method should be called after RSE startup is complete in
order to get the proper default workspace encoding.
-
-
Returns:
- the local default encoding
-
Since:
- 3.0
getEnvironmentEncoding
public
String getEnvironmentEncoding()
- Gets the encoding of the environment. This is the encoding being used by the JVM,
which by default is the machine encoding, unless changed explicitly.
-
-
Returns:
- the evironment encoding.
isXML
public boolean isXML(
String filePath)
- Returns whether the file is an XML file.
-
-
Parameters:
-
filePath
- the file path.
-
Returns:
-
true
if the file is an XML file, false
otherwise.
getXMLFileEncoding
public
String getXMLFileEncoding(
String filePath)
throws
IOException
- Gets the encoding of an XML file.
-
-
Parameters:
-
filePath
- the file path.
-
Returns:
- the encoding, or
null
if the encoding could not be determined.
-
Throws:
-
IOException
getEncodingFromBOM
public
String getEncodingFromBOM(
String filePath)
throws
IOException
- Gets the encoding from the Byte Order Mark (BOM).
-
-
Parameters:
-
filePath
- the file path.
-
Returns:
- the encoding, or
null
if there is no BOM.
-
Throws:
-
IOException
Copyright (c) IBM Corporation and others 2000, 2008. All Rights Reserved.