RSE
Release 1.0

org.eclipse.rse.services.clientserver
Class SystemEncodingUtil

java.lang.Object
  extended byorg.eclipse.rse.services.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

RSE
Release 1.0

Copyright (c) IBM Corporation and others 2000, 2006. All Rights Reserved.