Remote Systems
v6.4.1

com.ibm.etools.systems.core.clientserver
Class SystemEncodingUtil

java.lang.Object
  extended bycom.ibm.etools.systems.core.clientserver.SystemEncodingUtil

public class SystemEncodingUtil
extends Object

A singleton class that contains useful methods related to encodings.


Field Summary
static String ENCODING_UTF_8
           
 
Method Summary
 String getEncodingFromBOM(String filePath)
          Gets the encoding from the Byte Order Mark (BOM).
 String getEnvironmentEncoding()
          Gets the encoding of the environment.
static SystemEncodingUtil getInstance()
          Returns the singleton instance of the utility class.
 String getXMLFileEncoding(String filePath)
          Gets the encoding of an XML file.
 boolean isXML(String filePath)
          Returns whether the file is an XML file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_UTF_8

public static String ENCODING_UTF_8
Method Detail

getInstance

public static SystemEncodingUtil getInstance()
Returns the singleton instance of the utility class.

Returns:
the singleton instance.

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

Remote Systems
v6.4.1

Copyright © 2005 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.