java.nio.charset
Class Charset

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.nio.charset.Charset
All Implemented Interfaces:
Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset >

public abstract class Charset
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset >

A named mapping between sequences of sixteen-bit Unicode code units and sequences of bytes. This class defines methods for creating decoders and encoders and for retrieving the various names associated with a charset. Instances of this class are immutable.

This class also defines static methods for testing whether a particular charset is supported, for locating charset instances by name, and for constructing a map that contains every charset for which support is available in the current Java virtual machine. Support for new charsets can be added via the service-provider interface defined in the CharsetProvider sample code for java.nio.charset.spi.CharsetProvider definition code for java.nio.charset.spi.CharsetProvider class.

All of the methods defined in this class are safe for use by multiple concurrent threads.

Charset names

Charsets are named by strings composed of the following characters:

A charset name must begin with either a letter or a digit. The empty string is not a legal charset name. Charset names are not case-sensitive; that is, case is always ignored when comparing charset names. Charset names generally follow the conventions documented in
RFC 2278: IANA Charset Registration Procedures.

Every charset has a canonical name and may also have one or more aliases. The canonical name is returned by the name sample code for java.nio.charset.Charset.name definition code for java.nio.charset.Charset.name method of this class. Canonical names are, by convention, usually in upper case. The aliases of a charset are returned by the aliases sample code for java.nio.charset.Charset.aliases definition code for java.nio.charset.Charset.aliases method.

Some charsets have an historical name that is defined for compatibility with previous versions of the Java platform. A charset's historical name is either its canonical name or one of its aliases. The historical name is returned by the getEncoding() methods of the InputStreamReader sample code for java.io.InputStreamReader.getEncoding() definition code for java.io.InputStreamReader.getEncoding() and OutputStreamWriter sample code for java.io.OutputStreamWriter.getEncoding() definition code for java.io.OutputStreamWriter.getEncoding() classes.

If a charset listed in the IANA Charset Registry is supported by an implementation of the Java platform then its canonical name must be the name listed in the registry. Many charsets are given more than one name in the registry, in which case the registry identifies one of the names as MIME-preferred. If a charset has more than one registry name then its canonical name must be the MIME-preferred name and the other names in the registry must be valid aliases. If a supported charset is not listed in the IANA registry then its canonical name must begin with one of the strings "X-" or "x-".

The IANA charset registry does change over time, and so the canonical name and the aliases of a particular charset may also change over time. To ensure compatibility it is recommended that no alias ever be removed from a charset, and that if the canonical name of a charset is changed then its previous canonical name be made into an alias.

Standard charsets

Every implementation of the Java platform is required to support the following standard charsets. Consult the release documentation for your implementation to see if any other charsets are supported. The behavior of such optional charsets may differ between implementations.

Charset

Description

US-ASCII Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
ISO-8859-1   ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1
UTF-8 Eight-bit UCS Transformation Format
UTF-16BE Sixteen-bit UCS Transformation Format, big-endian byte order
UTF-16LE Sixteen-bit UCS Transformation Format, little-endian byte order
UTF-16 Sixteen-bit UCS Transformation Format, byte order identified by an optional byte-order mark

The UTF-8 charset is specified by RFC 2279; the transformation format upon which it is based is specified in Amendment 2 of ISO 10646-1 and is also described in the Unicode Standard.

The UTF-16 charsets are specified by RFC 2781; the transformation formats upon which they are based are specified in Amendment 1 of ISO 10646-1 and are also described in the Unicode Standard.

The UTF-16 charsets use sixteen-bit quantities and are therefore sensitive to byte order. In these encodings the byte order of a stream may be indicated by an initial byte-order mark represented by the Unicode character '\uFEFF'. Byte-order marks are handled as follows:

In any case, when a byte-order mark is read at the beginning of a decoding operation it is omitted from the resulting sequence of characters. Byte order marks occuring after the first element of an input sequence are not omitted since the same code is used to represent ZERO-WIDTH NON-BREAKING SPACE.

Every instance of the Java virtual machine has a default charset, which may or may not be one of the standard charsets. The default charset is determined during virtual-machine startup and typically depends upon the locale and charset being used by the underlying operating system.

Terminology

The name of this class is taken from the terms used in RFC 2278. In that document a charset is defined as the combination of a coded character set and a character-encoding scheme.

A coded character set is a mapping between a set of abstract characters and a set of integers. US-ASCII, ISO 8859-1, JIS X 0201, and full Unicode, which is the same as ISO 10646-1, are examples of coded character sets.

A character-encoding scheme is a mapping between a coded character set and a set of octet (eight-bit byte) sequences. UTF-8, UCS-2, UTF-16, ISO 2022, and EUC are examples of character-encoding schemes. Encoding schemes are often associated with a particular coded character set; UTF-8, for example, is used only to encode Unicode. Some schemes, however, are associated with multiple character sets; EUC, for example, can be used to encode characters in a variety of Asian character sets.

When a coded character set is used exclusively with a single character-encoding scheme then the corresponding charset is usually named for the character set; otherwise a charset is usually named for the encoding scheme and, possibly, the locale of the character sets that it supports. Hence US-ASCII is the name of the charset for US-ASCII while EUC-JP is the name of the charset that encodes the JIS X 0201, JIS X 0208, and JIS X 0212 character sets.

The native character encoding of the Java programming language is UTF-16. A charset in the Java platform therefore defines a mapping between sequences of sixteen-bit UTF-16 code units and sequences of bytes.

Since:
1.4
See Also:
CharsetDecoder sample code for java.nio.charset.CharsetDecoder definition code for java.nio.charset.CharsetDecoder , CharsetEncoder sample code for java.nio.charset.CharsetEncoder definition code for java.nio.charset.CharsetEncoder , CharsetProvider sample code for java.nio.charset.spi.CharsetProvider definition code for java.nio.charset.spi.CharsetProvider , Character sample code for java.lang.Character definition code for java.lang.Character

Constructor Summary
protected Charset sample code for java.nio.charset.Charset.Charset(java.lang.String, java.lang.String[]) definition code for java.nio.charset.Charset.Charset(java.lang.String, java.lang.String[]) (String sample code for java.lang.String definition code for java.lang.String  canonicalName, String sample code for java.lang.String definition code for java.lang.String [] aliases)
          Initializes a new charset with the given canonical name and alias set.
 
Method Summary
 Set sample code for java.util.Set definition code for java.util.Set <String sample code for java.lang.String definition code for java.lang.String > aliases sample code for java.nio.charset.Charset.aliases() definition code for java.nio.charset.Charset.aliases() ()
          Returns a set containing this charset's aliases.
static SortedMap sample code for java.util.SortedMap definition code for java.util.SortedMap <String sample code for java.lang.String definition code for java.lang.String ,Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset > availableCharsets sample code for java.nio.charset.Charset.availableCharsets() definition code for java.nio.charset.Charset.availableCharsets() ()
          Constructs a sorted map from canonical charset names to charset objects.
 boolean canEncode sample code for java.nio.charset.Charset.canEncode() definition code for java.nio.charset.Charset.canEncode() ()
          Tells whether or not this charset supports encoding.
 int compareTo sample code for java.nio.charset.Charset.compareTo(java.nio.charset.Charset) definition code for java.nio.charset.Charset.compareTo(java.nio.charset.Charset) (Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset  that)
          Compares this charset to another.
abstract  boolean contains sample code for java.nio.charset.Charset.contains(java.nio.charset.Charset) definition code for java.nio.charset.Charset.contains(java.nio.charset.Charset) (Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset  cs)
          Tells whether or not this charset contains the given charset.
 CharBuffer sample code for java.nio.CharBuffer definition code for java.nio.CharBuffer decode sample code for java.nio.charset.Charset.decode(java.nio.ByteBuffer) definition code for java.nio.charset.Charset.decode(java.nio.ByteBuffer) (ByteBuffer sample code for java.nio.ByteBuffer definition code for java.nio.ByteBuffer  bb)
          Convenience method that decodes bytes in this charset into Unicode characters.
static Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset defaultCharset sample code for java.nio.charset.Charset.defaultCharset() definition code for java.nio.charset.Charset.defaultCharset() ()
          Returns the default charset of this Java virtual machine.
 String sample code for java.lang.String definition code for java.lang.String displayName sample code for java.nio.charset.Charset.displayName() definition code for java.nio.charset.Charset.displayName() ()
          Returns this charset's human-readable name for the default locale.
 String sample code for java.lang.String definition code for java.lang.String displayName sample code for java.nio.charset.Charset.displayName(java.util.Locale) definition code for java.nio.charset.Charset.displayName(java.util.Locale) (Locale sample code for java.util.Locale definition code for java.util.Locale  locale)
          Returns this charset's human-readable name for the given locale.
 ByteBuffer sample code for java.nio.ByteBuffer definition code for java.nio.ByteBuffer encode sample code for java.nio.charset.Charset.encode(java.nio.CharBuffer) definition code for java.nio.charset.Charset.encode(java.nio.CharBuffer) (CharBuffer sample code for java.nio.CharBuffer definition code for java.nio.CharBuffer  cb)
          Convenience method that encodes Unicode characters into bytes in this charset.
 ByteBuffer sample code for java.nio.ByteBuffer definition code for java.nio.ByteBuffer encode sample code for java.nio.charset.Charset.encode(java.lang.String) definition code for java.nio.charset.Charset.encode(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  str)
          Convenience method that encodes a string into bytes in this charset.
 boolean equals sample code for java.nio.charset.Charset.equals(java.lang.Object) definition code for java.nio.charset.Charset.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  ob)
          Tells whether or not this object is equal to another.
static Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset forName sample code for java.nio.charset.Charset.forName(java.lang.String) definition code for java.nio.charset.Charset.forName(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  charsetName)
          Returns a charset object for the named charset.
 int hashCode sample code for java.nio.charset.Charset.hashCode() definition code for java.nio.charset.Charset.hashCode() ()
          Computes a hashcode for this charset.
 boolean isRegistered sample code for java.nio.charset.Charset.isRegistered() definition code for java.nio.charset.Charset.isRegistered() ()
          Tells whether or not this charset is registered in the IANA Charset Registry.
static boolean isSupported sample code for java.nio.charset.Charset.isSupported(java.lang.String) definition code for java.nio.charset.Charset.isSupported(java.lang.String) (String sample code for java.lang.String definition code for java.lang.String  charsetName)
          Tells whether the named charset is supported.
 String sample code for java.lang.String definition code for java.lang.String name sample code for java.nio.charset.Charset.name() definition code for java.nio.charset.Charset.name() ()
          Returns this charset's canonical name.
abstract  CharsetDecoder sample code for java.nio.charset.CharsetDecoder definition code for java.nio.charset.CharsetDecoder newDecoder sample code for java.nio.charset.Charset.newDecoder() definition code for java.nio.charset.Charset.newDecoder() ()
          Constructs a new decoder for this charset.
abstract  CharsetEncoder sample code for java.nio.charset.CharsetEncoder definition code for java.nio.charset.CharsetEncoder newEncoder sample code for java.nio.charset.Charset.newEncoder() definition code for java.nio.charset.Charset.newEncoder() ()
          Constructs a new encoder for this charset.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.nio.charset.Charset.toString() definition code for java.nio.charset.Charset.toString() ()
          Returns a string describing this charset.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

Charset sample code for java.nio.charset.Charset(java.lang.String, java.lang.String[]) definition code for java.nio.charset.Charset(java.lang.String, java.lang.String[])

protected Charset(String sample code for java.lang.String definition code for java.lang.String  canonicalName,
                  String sample code for java.lang.String definition code for java.lang.String [] aliases)
Initializes a new charset with the given canonical name and alias set.

Parameters:
canonicalName - The canonical name of this charset
aliases - An array of this charset's aliases, or null if it has no aliases
Throws:
IllegalCharsetNameException sample code for java.nio.charset.IllegalCharsetNameException definition code for java.nio.charset.IllegalCharsetNameException - If the canonical name or any of the aliases are illegal
Method Detail

isSupported sample code for java.nio.charset.Charset.isSupported(java.lang.String) definition code for java.nio.charset.Charset.isSupported(java.lang.String)

public static boolean isSupported(String sample code for java.lang.String definition code for java.lang.String  charsetName)
Tells whether the named charset is supported.

Parameters:
charsetName - The name of the requested charset; may be either a canonical name or an alias
Returns:
true if, and only if, support for the named charset is available in the current Java virtual machine
Throws:
IllegalCharsetNameException sample code for java.nio.charset.IllegalCharsetNameException definition code for java.nio.charset.IllegalCharsetNameException - If the given charset name is illegal

forName sample code for java.nio.charset.Charset.forName(java.lang.String) definition code for java.nio.charset.Charset.forName(java.lang.String)

public static Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset  forName(String sample code for java.lang.String definition code for java.lang.String  charsetName)
Returns a charset object for the named charset.

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
Throws:
IllegalCharsetNameException sample code for java.nio.charset.IllegalCharsetNameException definition code for java.nio.charset.IllegalCharsetNameException - If the given charset name is illegal
UnsupportedCharsetException sample code for java.nio.charset.UnsupportedCharsetException definition code for java.nio.charset.UnsupportedCharsetException - If no support for the named charset is available in this instance of the Java virtual machine

availableCharsets sample code for java.nio.charset.Charset.availableCharsets() definition code for java.nio.charset.Charset.availableCharsets()

public static SortedMap sample code for java.util.SortedMap definition code for java.util.SortedMap <String sample code for java.lang.String definition code for java.lang.String ,Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset > availableCharsets()
Constructs a sorted map from canonical charset names to charset objects.

The map returned by this method will have one entry for each charset for which support is available in the current Java virtual machine. If two or more supported charsets have the same canonical name then the resulting map will contain just one of them; which one it will contain is not specified.

The invocation of this method, and the subsequent use of the resulting map, may cause time-consuming disk or network I/O operations to occur. This method is provided for applications that need to enumerate all of the available charsets, for example to allow user charset selection. This method is not used by the forName sample code for java.nio.charset.Charset.forName(java.lang.String) definition code for java.nio.charset.Charset.forName(java.lang.String) method, which instead employs an efficient incremental lookup algorithm.

This method may return different results at different times if new charset providers are dynamically made available to the current Java virtual machine. In the absence of such changes, the charsets returned by this method are exactly those that can be retrieved via the forName sample code for java.nio.charset.Charset.forName(java.lang.String) definition code for java.nio.charset.Charset.forName(java.lang.String) method.

Returns:
An immutable, case-insensitive map from canonical charset names to charset objects

defaultCharset sample code for java.nio.charset.Charset.defaultCharset() definition code for java.nio.charset.Charset.defaultCharset()

public static Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset  defaultCharset()
Returns the default charset of this Java virtual machine.

The default charset is determined during virtual-machine startup and typically depends upon the locale and charset of the underlying operating system.

Returns:
A charset object for the default charset
Since:
1.5

name sample code for java.nio.charset.Charset.name() definition code for java.nio.charset.Charset.name()

public final String sample code for java.lang.String definition code for java.lang.String  name()
Returns this charset's canonical name.

Returns:
The canonical name of this charset

aliases sample code for java.nio.charset.Charset.aliases() definition code for java.nio.charset.Charset.aliases()

public final Set sample code for java.util.Set definition code for java.util.Set <String sample code for java.lang.String definition code for java.lang.String > aliases()
Returns a set containing this charset's aliases.

Returns:
An immutable set of this charset's aliases

displayName sample code for java.nio.charset.Charset.displayName() definition code for java.nio.charset.Charset.displayName()

public String sample code for java.lang.String definition code for java.lang.String  displayName()
Returns this charset's human-readable name for the default locale.

The default implementation of this method simply returns this charset's canonical name. Concrete subclasses of this class may override this method in order to provide a localized display name.

Returns:
The display name of this charset in the default locale

isRegistered sample code for java.nio.charset.Charset.isRegistered() definition code for java.nio.charset.Charset.isRegistered()

public final boolean isRegistered()
Tells whether or not this charset is registered in the IANA Charset Registry.

Returns:
true if, and only if, this charset is known by its implementor to be registered with the IANA

displayName sample code for java.nio.charset.Charset.displayName(java.util.Locale) definition code for java.nio.charset.Charset.displayName(java.util.Locale)

public String sample code for java.lang.String definition code for java.lang.String  displayName(Locale sample code for java.util.Locale definition code for java.util.Locale  locale)
Returns this charset's human-readable name for the given locale.

The default implementation of this method simply returns this charset's canonical name. Concrete subclasses of this class may override this method in order to provide a localized display name.

Parameters:
locale - The locale for which the display name is to be retrieved
Returns:
The display name of this charset in the given locale

contains sample code for java.nio.charset.Charset.contains(java.nio.charset.Charset) definition code for java.nio.charset.Charset.contains(java.nio.charset.Charset)

public abstract boolean contains(Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset  cs)
Tells whether or not this charset contains the given charset.

A charset C is said to contain a charset D if, and only if, every character representable in D is also representable in C. If this relationship holds then it is guaranteed that every string that can be encoded in D can also be encoded in C without performing any replacements.

That C contains D does not imply that each character representable in C by a particular byte sequence is represented in D by the same byte sequence, although sometimes this is the case.

Every charset contains itself.

This method computes an approximation of the containment relation: If it returns true then the given charset is known to be contained by this charset; if it returns false, however, then it is not necessarily the case that the given charset is not contained in this charset.

Returns:
true if, and only if, the given charset is contained in this charset

newDecoder sample code for java.nio.charset.Charset.newDecoder() definition code for java.nio.charset.Charset.newDecoder()

public abstract CharsetDecoder sample code for java.nio.charset.CharsetDecoder definition code for java.nio.charset.CharsetDecoder  newDecoder()
Constructs a new decoder for this charset.

Returns:
A new decoder for this charset

newEncoder sample code for java.nio.charset.Charset.newEncoder() definition code for java.nio.charset.Charset.newEncoder()

public abstract CharsetEncoder sample code for java.nio.charset.CharsetEncoder definition code for java.nio.charset.CharsetEncoder  newEncoder()
Constructs a new encoder for this charset.

Returns:
A new encoder for this charset
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - If this charset does not support encoding

canEncode sample code for java.nio.charset.Charset.canEncode() definition code for java.nio.charset.Charset.canEncode()

public boolean canEncode()
Tells whether or not this charset supports encoding.

Nearly all charsets support encoding. The primary exceptions are special-purpose auto-detect charsets whose decoders can determine which of several possible encoding schemes is in use by examining the input byte sequence. Such charsets do not support encoding because there is no way to determine which encoding should be used on output. Implementations of such charsets should override this method to return false.

Returns:
true if, and only if, this charset supports encoding

decode sample code for java.nio.charset.Charset.decode(java.nio.ByteBuffer) definition code for java.nio.charset.Charset.decode(java.nio.ByteBuffer)

public final CharBuffer sample code for java.nio.CharBuffer definition code for java.nio.CharBuffer  decode(ByteBuffer sample code for java.nio.ByteBuffer definition code for java.nio.ByteBuffer  bb)
Convenience method that decodes bytes in this charset into Unicode characters.

An invocation of this method upon a charset cs returns the same result as the expression

     cs.newDecoder()
       .onMalformedInput(CodingErrorAction.REPLACE)
       .onUnmappableCharacter(CodingErrorAction.REPLACE)
       .decode(bb); 
except that it is potentially more efficient because it can cache decoders between successive invocations.

This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement byte array. In order to detect such sequences, use the CharsetDecoder.decode(java.nio.ByteBuffer) sample code for java.nio.charset.CharsetDecoder.decode(java.nio.ByteBuffer) definition code for java.nio.charset.CharsetDecoder.decode(java.nio.ByteBuffer) method directly.

Parameters:
bb - The byte buffer to be decoded
Returns:
A char buffer containing the decoded characters

encode sample code for java.nio.charset.Charset.encode(java.nio.CharBuffer) definition code for java.nio.charset.Charset.encode(java.nio.CharBuffer)

public final ByteBuffer sample code for java.nio.ByteBuffer definition code for java.nio.ByteBuffer  encode(CharBuffer sample code for java.nio.CharBuffer definition code for java.nio.CharBuffer  cb)
Convenience method that encodes Unicode characters into bytes in this charset.

An invocation of this method upon a charset cs returns the same result as the expression

     cs.newEncoder()
       .onMalformedInput(CodingErrorAction.REPLACE)
       .onUnmappableCharacter(CodingErrorAction.REPLACE)
       .encode(bb); 
except that it is potentially more efficient because it can cache encoders between successive invocations.

This method always replaces malformed-input and unmappable-character sequences with this charset's default replacement string. In order to detect such sequences, use the CharsetEncoder.encode(java.nio.CharBuffer) sample code for java.nio.charset.CharsetEncoder.encode(java.nio.CharBuffer) definition code for java.nio.charset.CharsetEncoder.encode(java.nio.CharBuffer) method directly.

Parameters:
cb - The char buffer to be encoded
Returns:
A byte buffer containing the encoded characters

encode sample code for java.nio.charset.Charset.encode(java.lang.String) definition code for java.nio.charset.Charset.encode(java.lang.String)

public final ByteBuffer sample code for java.nio.ByteBuffer definition code for java.nio.ByteBuffer  encode(String sample code for java.lang.String definition code for java.lang.String  str)
Convenience method that encodes a string into bytes in this charset.

An invocation of this method upon a charset cs returns the same result as the expression

     cs.encode(CharBuffer.wrap(s)); 

Parameters:
str - The string to be encoded
Returns:
A byte buffer containing the encoded characters

compareTo sample code for java.nio.charset.Charset.compareTo(java.nio.charset.Charset) definition code for java.nio.charset.Charset.compareTo(java.nio.charset.Charset)

public final int compareTo(Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset  that)
Compares this charset to another.

Charsets are ordered by their canonical names, without regard to case.

Specified by:
compareTo sample code for java.lang.Comparable.compareTo(T) definition code for java.lang.Comparable.compareTo(T) in interface Comparable sample code for java.lang.Comparable definition code for java.lang.Comparable <Charset sample code for java.nio.charset.Charset definition code for java.nio.charset.Charset >
Parameters:
that - The charset to which this charset is to be compared
Returns:
A negative integer, zero, or a positive integer as this charset is less than, equal to, or greater than the specified charset

hashCode sample code for java.nio.charset.Charset.hashCode() definition code for java.nio.charset.Charset.hashCode()

public final int hashCode()
Computes a hashcode for this charset.

Overrides:
hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
An integer hashcode
See Also:
Object.equals(java.lang.Object) sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

equals sample code for java.nio.charset.Charset.equals(java.lang.Object) definition code for java.nio.charset.Charset.equals(java.lang.Object)

public final boolean equals(Object sample code for java.lang.Object definition code for java.lang.Object  ob)
Tells whether or not this object is equal to another.

Two charsets are equal if, and only if, they have the same canonical names. A charset is never equal to any other type of object.

Overrides:
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) in class Object sample code for java.lang.Object definition code for java.lang.Object
Parameters:
ob - the reference object with which to compare.
Returns:
true if, and only if, this charset is equal to the given object
See Also:
Object.hashCode() sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , Hashtable sample code for java.util.Hashtable definition code for java.util.Hashtable

toString sample code for java.nio.charset.Charset.toString() definition code for java.nio.charset.Charset.toString()

public final String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string describing this charset.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
A string describing this charset