# CharsetProvider

public abstract class **CharsetProvider** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Charset service-provider class.

A charset provider is a concrete subclass of this class that has a
zero-argument constructor and some number of associated charset
implementation classes. Charset providers may be installed in an instance
of the Java platform as extensions, that is, jar files placed into any of
the usual extension directories. Providers may also be made available by
adding them to the applet or application class path or by some other
platform-specific means. Charset providers are looked up via the current
thread's `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Thread.html#getContextClassLoader()`.

A charset provider identifies itself with a provider-configuration file
named java.nio.charset.spi.CharsetProvider in the resource
directory META-INF/services. The file should contain a list of
fully-qualified concrete charset-provider class names, one per line. A line
is terminated by any one of a line feed ('\\n'), a carriage return
('\\r'), or a carriage return followed immediately by a line feed.
Space and tab characters surrounding each name, as well as blank lines, are
ignored. The comment character is '#' ('\\u0023'); on
each line all characters following the first comment character are ignored.
The file must be encoded in UTF-8.

If a particular concrete charset provider class is named in more than
one configuration file, or is named in the same configuration file more than
once, then the duplicates will be ignored. The configuration file naming a
particular provider need not be in the same jar file or other distribution
unit as the provider itself. The provider must be accessible from the same
class loader that was initially queried to locate the configuration file;
this is not necessarily the class loader that loaded the file.

<br />

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html`

### Protected Constructor Summary

|---|---|
|   | [CharsetProvider](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/spi/CharsetProvider.html#CharsetProvider())() Initializes a new charset provider. |

### Public Method Summary

|---|---|
| abstract [Charset](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html) | [charsetForName](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/spi/CharsetProvider.html#charsetForName(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName) Retrieves a charset for the given charset name. |
| abstract [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<[Charset](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html)\> | [charsets](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/spi/CharsetProvider.html#charsets())() Creates an iterator that iterates over the charsets supported by this provider. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Protected Constructors

#### protected
**CharsetProvider**
()

Initializes a new charset provider.

##### Throws

| [SecurityException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/SecurityException.html) | If a security manager has been installed and it denies `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/RuntimePermission.html`("charsetProvider") |
|---|---|

## Public Methods

#### public abstract [Charset](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html)
**charsetForName**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) charsetName)

Retrieves a charset for the given charset name.

##### Parameters

| charsetName | The name of the requested charset; may be either a canonical name or an alias |
|---|---|

##### Returns

- A charset object for the named charset, or null if the named charset is not supported by this provider

#### public abstract [Iterator](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Iterator.html)\<[Charset](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html)\>
**charsets**
()

Creates an iterator that iterates over the charsets supported by this
provider. This method is used in the implementation of the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/Charset.html#availableCharsets()`
method.

##### Returns

- The new iterator