Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

RSE
Release 3.0

org.eclipse.rse.services.clientserver
Class SystemEncodingUtil


java.lang.Object
  extended by 
org.eclipse.rse.services.clientserver.SystemEncodingUtil

public class SystemEncodingUtil
extends Object

A singleton class that contains useful methods related to encodings.


Nested Class Summary
static class SystemEncodingUtil.DefaultEncodingProvider
          Provider for the default encodings that RSE uses.
 
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 getLocalDefaultEncoding ()
          Returns the local default encoding as provided by the default encoding provider.
  String getXMLFileEncoding ( String filePath)
          Gets the encoding of an XML file.
 boolean isXML ( String filePath)
          Returns whether the file is an XML file.
 void setDefaultEncodingProvider ( SystemEncodingUtil.DefaultEncodingProvider p)
          Change the default encoding provider.
 
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.

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

RSE
Release 3.0

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

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire