The java.nio.charset.spi package contains a service-provider class to create a new charset class. This package contains only one class, CharSetProvider.
Note | To learn more about java.nio.charset.spi package, see: http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/spi/package-summary.html |
The CharSetProvider class is a subclass of the Charset class. This class takes no arguments in the default constructor. You can look up the Charset provider with the help of the loaded context class of the current thread. The methods used in the CharSetProvider class are:
charsetForName() : Returns an object of the Charset class. The charsetForName() method takes charsetName of String type as an input parameter.
charsets() : Returns a collection of objects of the Charset class supported by the provider.