java.nio.charset

Class Charset

public abstract class Charset extends Object implements Comparable<Charset>

Since: 1.4

UNKNOWN: updated to 1.5

Constructor Summary
protected Charset(String canonicalName, String[] aliases)
Method Summary
Set<String>aliases()
static SortedMap<String,Charset>availableCharsets()
booleancanEncode()
intcompareTo(Charset other)
abstract booleancontains(Charset cs)
CharBufferdecode(ByteBuffer bb)
static CharsetdefaultCharset()
Returns the system default charset.
StringdisplayName()
StringdisplayName(Locale locale)
ByteBufferencode(CharBuffer cb)
ByteBufferencode(String str)
booleanequals(Object ob)
static CharsetforName(String charsetName)
Returns the Charset instance for the charset of the given name.
inthashCode()
booleanisRegistered()
static booleanisSupported(String charsetName)
Stringname()
abstract CharsetDecodernewDecoder()
abstract CharsetEncodernewEncoder()
StringtoString()

Constructor Detail

Charset

protected Charset(String canonicalName, String[] aliases)

Method Detail

aliases

public final Set<String> aliases()

availableCharsets

public static SortedMap<String,Charset> availableCharsets()

canEncode

public boolean canEncode()

compareTo

public final int compareTo(Charset other)

contains

public abstract boolean contains(Charset cs)

decode

public final CharBuffer decode(ByteBuffer bb)

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

displayName

public String displayName()

displayName

public String displayName(Locale locale)

encode

public final ByteBuffer encode(CharBuffer cb)

encode

public final ByteBuffer encode(String str)

equals

public final boolean equals(Object ob)

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.

hashCode

public final int hashCode()

isRegistered

public final boolean isRegistered()

isSupported

public static boolean isSupported(String charsetName)

name

public final String name()

newDecoder

public abstract CharsetDecoder newDecoder()

newEncoder

public abstract CharsetEncoder newEncoder()

toString

public final String toString()