aicas logo Jamaica 3.4 release 8

java.nio.charset
Class Charset

java.lang.Object
  extended by java.nio.charset.Charset
All Implemented Interfaces:
Comparable

public abstract class Charset
extends Object
implements Comparable

Since:
1.4
Status:
updated to 1.5

Constructor Summary
protected Charset(String canonicalName, String[] aliases)
           
 
Method Summary
 Set aliases()
           
static SortedMap availableCharsets()
           
 boolean canEncode()
           
 int compareTo(Object ob)
          compareTo compares this to another object.
abstract  boolean contains(Charset cs)
           
 CharBuffer decode(ByteBuffer bb)
           
static Charset defaultCharset()
          Returns the system default charset.
 String displayName()
           
 String displayName(Locale locale)
           
 ByteBuffer encode(CharBuffer cb)
           
 ByteBuffer encode(String str)
           
 boolean equals(Object ob)
          equals compares this object to another object.
static Charset forName(String charsetName)
          Returns the Charset instance for the charset of the given name.
 int hashCode()
          hashCode returns a hash code for this object.
 boolean isRegistered()
           
static boolean isSupported(String charsetName)
           
 String name()
           
abstract  CharsetDecoder newDecoder()
           
abstract  CharsetEncoder newEncoder()
           
 String toString()
          toString creates a printable string that represents this object for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Charset

protected Charset(String canonicalName,
                  String[] aliases)
Method Detail

defaultCharset

public static Charset defaultCharset()
Returns the system default charset. This may be set by the user or VM with the file.encoding property.

Since:
1.5

isSupported

public static boolean isSupported(String charsetName)

forName

public static Charset forName(String charsetName)
Returns the Charset instance for the charset of the given name.

Parameters:
charsetName -
Returns:
the Charset instance for the indicated charset
Throws:
UnsupportedCharsetException - if this VM does not support the charset of the given name.
IllegalCharsetNameException - if the given charset name is legal.
IllegalArgumentException - if charsetName is null.

availableCharsets

public static SortedMap availableCharsets()

name

public final String name()

aliases

public final Set aliases()

displayName

public String displayName()

displayName

public String displayName(Locale locale)

isRegistered

public final boolean isRegistered()

contains

public abstract boolean contains(Charset cs)

newDecoder

public abstract CharsetDecoder newDecoder()

newEncoder

public abstract CharsetEncoder newEncoder()

canEncode

public boolean canEncode()

encode

public final ByteBuffer encode(CharBuffer cb)

encode

public final ByteBuffer encode(String str)

decode

public final CharBuffer decode(ByteBuffer bb)

compareTo

public final int compareTo(Object ob)
Description copied from interface: Comparable
compareTo compares this to another object.

for any a, b and c that are comparable instance of the same class, the following must hold:

a.compareTo(b) < 0 ==> b.compareTo(a) > 0 a.compareTo(b) > 0 ==> b.compareTo(a) < 0 a.compareTo(b) == 0 ==> b.compareTo(a) == 0

a.compareTo(b) == 0 && a.compareTo(c) < 0 ==> b.compareTo(c) < 0 a.compareTo(b) == 0 && a.compareTo(c) > 0 ==> b.compareTo(c) > 0 a.compareTo(b) == 0 && a.compareTo(c) == 0 ==> b.compareTo(c) == 0

a.compareTo(b) < 0 && b.compareTo(c) < 0 ==> a.compareTo(c) < 0 a.compareTo(b) > 0 && b.compareTo(c) > 0 ==> a.compareTo(c) > 0

Specified by:
compareTo in interface Comparable
Parameters:
ob - the other object
Returns:
a value <0 if this < o, 0 if this == o and a value > 0 if this > o.

hashCode

public final int hashCode()
Description copied from class: Object
hashCode returns a hash code for this object. The hash code must be equal for two objects a and b if a.equals(b) is true.

The default implementation returns System.identityHashCode(this).

Overrides:
hashCode in class Object
Returns:
a hash code value.

equals

public final boolean equals(Object ob)
Description copied from class: Object
equals compares this object to another object.

Equals must be symmetric (a.equals(b) == b.equals(a)), reflexive (a.equals(a)==true) and transitive (a.equals(b) && b.equals(c) IMPLIES (a.equals(c))) and not change over time (a.equals(b) == a.equals(b)). a.equals(null) should always return false.

If a.equals(b) is true for two objects a and b, then a.hashCode()==b.hashCode() must hold.

The default implementation of equals returns this==other.

Overrides:
equals in class Object
Parameters:
ob - the other object.
Returns:
if this and other are considered equal.

toString

public final String toString()
Description copied from class: Object
toString creates a printable string that represents this object for debugging purposes.

The default implementation returns getClass().getName() + '@' + Integer.toHexString(hashCode()).

Overrides:
toString in class Object
Returns:
a string identifying this object.

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.