java.nio jar包下载.charset 属于哪个jar包

java.nio.charset.Charset
Start line: &
End line: &
Snippet Preview
Snippet HTML Code
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&package&java.nio.&&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&;&import&; A named mapping between sequences of sixteen-bit Unicode code units and sequences of
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
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:
The uppercase letters &A& through &Z&
(&\u0041& through &\u005a&),
The lowercase letters &a& through &z&
(&\u0061& through &\u007a&),
The digits &0& through &9&
(&\u0030& through &\u0039&),
The dash character &-&
(&\u002d&, HYPHEN-MINUS),
The period character &.&
(&\u002e&, FULL STOP),
The colon character &:&
(&\u003a&, COLON), and
The underscore character &_&
(&\u005f&, LOW LINE).
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- 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
The canonical name is returned by the name method
of this class.
Canonical names are, by convention, usually in upper case.
The aliases of a charset are returned by the aliases
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.
historical name is returned by the getEncoding() methods of the
InputStreamReader and
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.
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.
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.
CharsetDescriptionUS-ASCIISeven-bit ASCII, a.k.a. ISO646-US,
a.k.a. the Basic Latin block of the Unicode character setISO-8859-1
ISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1UTF-8Eight-bit UCS Transformation FormatUTF-16BESixteen-bit UCS Transformation Format,
big-endian byte orderUTF-16LESixteen-bit UCS Transformation Format,
little-endian byte orderUTF-16Sixteen-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
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
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:
When decoding, the UTF-16BE and UTF-16LE
charsets ignore byte- when encoding, they do not write
byte-order marks.
When decoding, the UTF-16 charset interprets a byte-order
mark to indicate the byte order of the stream but defaults to big-endian
if there is no byte- when encoding, it uses big-endian byte
order and writes a big-endian byte-order mark.
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.
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.
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
UTF-8, for example, is used only to encode Unicode.
Some schemes, however,
are associated with mul 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
f 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
A charset in the Java platform therefore defines a mapping between
sequences of sixteen-bit UTF-16 code units and sequences of bytes.
public&abstract&class&&&&&implements&&>{&&&&&&&&private&static&&&=&null;&&&&static&boolean&(&bl)&{&&&&&&&&&&&&&&&&&&&&&&if&(&==&null)&{&&&&&&&&&&&&if&(!sun.misc.VM.())&&&&&&&&&&&&&&&&return&false;&&&&&&&&&&&&&=&AccessController.(&&&&&&&&&&&&&&&&new&("sun.nio.cs.bugLevel"));&&&&&&&&&&&&if&(&==&null)&&&&&&&&&&&&&&&&&=&"";&&&&&&&&}&&&&&&&&return&(&!=&null)&&&&.(bl);&&&&}&&&& Checks that the given string is a legal charset name.
&&&&private&static&void&(&s)&{&&&&&&&&int&n&=&s.();&&&&&&&&if&(!("1.4"))&{&&&&&&&&&&&&if&(n&==&0)&&&&&&&&&&&&&&&&throw&new&(s);&&&&&&&&}&&&&&&&&for&(int&i&=&0;&i&&&n;&i++)&{&&&&&&&&&&&&char&c&=&s.(i);&&&&&&&&&&&&if&(c&>=&'A'&&&&c&&=&'Z')&continue;&&&&&&&&&&&&if&(c&>=&'a'&&&&c&&=&'z')&continue;&&&&&&&&&&&&if&(c&>=&'0'&&&&c&&=&'9')&continue;&&&&&&&&&&&&if&(c&==&'-'&&&&i&!=&0)&continue;&&&&&&&&&&&&if&(c&==&':'&&&&i&!=&0)&continue;&&&&&&&&&&&&if&(c&==&'_'&&&&i&!=&0)&continue;&&&&&&&&&&&&if&(c&==&'.'&&&&i&!=&0)&continue;&&&&&&&&&&&&throw&new&(s);&&&&&&&&}&&&&}&&&&&&&&private&static&&&=&new&();&&&&&&&&&&&&&&&&private&static&volatile&[]&&=&null;&&&&&private&static&volatile&[]&&=&null;&&&&&private&static&void&(&charsetName,&&cs)&{&&&&&&&&&=&;&&&&&&&&&=&new&[]&{&charsetName,&cs&};&&&&}&&&&&&&&&&&&&&&&&&&&private&static&&()&{&&&&&&&&return&new&()&{&&&&&&&&&&&&&&&&&&=&ClassLoader.();&&&&&&&&&&&&&&&&&>&&=&&&&&&&&&&&&&&&&&&&&ServiceLoader.(.class,&);&&&&&&&&&&&&&&&&&>&&=&.();&&&&&&&&&&&&&&&&&&=&null;&&&&&&&&&&&&&&&&private&boolean&()&{&&&&&&&&&&&&&&&&&&&&while&(&==&null)&{&&&&&&&&&&&&&&&&&&&&&&&&try&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&if&(!.())&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&return&false;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&=&.();&&&&&&&&&&&&&&&&&&&&&&&&}&catch&(&sce)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&if&(sce.()&instanceof&)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&continue;&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&&&&&&&&&&throw⪰&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&&return&true;&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&public&boolean&()&{&&&&&&&&&&&&&&&&&&&&return&();&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&public&&()&{&&&&&&&&&&&&&&&&&&&&if&(!())&&&&&&&&&&&&&&&&&&&&&&&&throw&new&();&&&&&&&&&&&&&&&&&&&&&n&=&;&&&&&&&&&&&&&&&&&&&&&=&null;&&&&&&&&&&&&&&&&&&&&return&n;&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&public&void&()&{&&&&&&&&&&&&&&&&&&&&throw&new&();&&&&&&&&&&&&&&&&}&&&&&&&&&&&&};&&&&}&&&&&&&&private&static&&&=&new&();&&&&private&static&&(final&&charsetName)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&if&(!sun.misc.VM.())&&&&&&&&&&&&return&null;&&&&&&&&if&(.()&!=&null)&&&&&&&&&&&&&&&&&&&&&&&&return&null;&&&&&&&&try&{&&&&&&&&&&&&.();&&&&&&&&&&&&return&AccessController.(&&&&&&&&&&&&&&&&new&&>()&{&&&&&&&&&&&&&&&&&&&&public&&()&{&&&&&&&&&&&&&&&&&&&&&&&&for&(&i&=&();&i.();)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&cp&=&()i.();&&&&&&&&&&&&&&&&&&&&&&&&&&&&&cs&=&cp.(charsetName);&&&&&&&&&&&&&&&&&&&&&&&&&&&&if&(cs&!=&null)&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&return&cs;&&&&&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&&&&&&return&null;&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&});&&&&&&&&}&finally&{&&&&&&&&&&&&.(null);&&&&&&&&}&&&&}&&&&&&&&private&static&&&=&new&();&&&&private&static&boolean&&=&false;&&&&private&static&&&=&null;&&&&private&static&void&()&{&&&&&&&&AccessController.(new&&>()&{&&&&&&&&&&&&&&&&public&&()&{&&&&&&&&&&&&&&&&&&&&try&{&&&&&&&&&&&&&&&&&&&&&&&&&epc&&&&&&&&&&&&&&&&&&&&&&&&&&&&=&Class.("sun.nio.cs.ext.ExtendedCharsets");&&&&&&&&&&&&&&&&&&&&&&&&&=&()epc.();&&&&&&&&&&&&&&&&&&&&}&catch&(&x)&{&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&}&catch&(&x)&{&&&&&&&&&&&&&&&&&&&&&&&&throw&new&(x);&&&&&&&&&&&&&&&&&&&&}&catch&(&x)&{&&&&&&&&&&&&&&&&&&&&&&&&throw&new&(x);&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&&return&null;&&&&&&&&&&&&&&&&}&&&&&&&&&&&&});&&&&}&&&&private&static&&(&charsetName)&{&&&&&&&&&ecp&=&null;&&&&&&&&synchronized&()&{&&&&&&&&&&&&if&(!)&{&&&&&&&&&&&&&&&&();&&&&&&&&&&&&&&&&&=&true;&&&&&&&&&&&&}&&&&&&&&&&&&ecp&=&;&&&&&&&&}&&&&&&&&return&(ecp&!=&null)&?&ecp.(charsetName)&:&null;&&&&}&&&&private&static&&(&charsetName)&{&&&&&&&&if&(charsetName&==&null)&&&&&&&&&&&&throw&new&("Null&charset&name");&&&&&&&&[]&a;&&&&&&&&if&((a&=&)&!=&null&&&&charsetName.(a[0]))&&&&&&&&&&&&return&()a[1];&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&return&(charsetName);&&&&}&&&&private&static&&(&charsetName)&{&&&&&&&&[]&a;&&&&&&&&if&((a&=&)&!=&null&&&&charsetName.(a[0]))&{&&&&&&&&&&&&&=&;&&&&&&&&&&&&&=&a;&&&&&&&&&&&&return&()a[1];&&&&&&&&}&&&&&&&&&cs;&&&&&&&&if&((cs&=&.(charsetName))&!=&null&||&&&&&&&&&&&&(cs&=&(charsetName))&&&&&&&&&&&!=&null&||&&&&&&&&&&&&(cs&=&(charsetName))&&&&&&&&&&&&&&!=&null)&&&&&&&&{&&&&&&&&&&&&(charsetName,&cs);&&&&&&&&&&&&return&cs;&&&&&&&&}&&&&&&&&&&&&&&&&(charsetName);&&&&&&&&return&null;&&&&}&&&& Tells whether the named charset is supported.
&&&&public&static&boolean&(&charsetName)&{&&&&&&&&return&((charsetName)&!=&null);&&&&}&&&& Returns a charset object for the named charset.
&&&&public&static&&(&charsetName)&{&&&&&&&&&cs&=&(charsetName);&&&&&&&&if&(cs&!=&null)&&&&&&&&&&&&return&cs;&&&&&&&&throw&new&(charsetName);&&&&}&&&&&&&&&&&&&&&&private&static&void&(&i,&&m)&{&&&&&&&&while&(i.())&{&&&&&&&&&&&&&cs&=&()i.();&&&&&&&&&&&&if&(!m.(cs.()))&&&&&&&&&&&&&&&&m.(cs.(),&cs);&&&&&&&&}&&&&}&&&& 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.
two or more supported charsets have the same canonical name then the
resulting map will cont 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
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 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
&&&&public&static&&,>&()&{&&&&&&&&return&AccessController.(&&&&&&&&&&&&new&&&,>>()&{&&&&&&&&&&&&&&&&public&&,>&()&{&&&&&&&&&&&&&&&&&&&&&,>&m&=&&&&&&&&&&&&&&&&&&&&&&&&new&&,>(&&&&&&&&&&&&&&&&&&&&&&&&&&&&.);&&&&&&&&&&&&&&&&&&&&(.(),&m);&&&&&&&&&&&&&&&&&&&&for&(&i&=&();&i.();)&{&&&&&&&&&&&&&&&&&&&&&&&&&cp&=&()i.();&&&&&&&&&&&&&&&&&&&&&&&&(cp.(),&m);&&&&&&&&&&&&&&&&&&&&}&&&&&&&&&&&&&&&&&&&&return&Collections.(m);&&&&&&&&&&&&&&&&}&&&&&&&&&&&&});&&&&}&&&&private&static&volatile&&;&&&& 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.
&&&&public&static&&()&{&&&&&&&&if&(&==&null)&{&&&&&&&&&&&&synchronized&(.class)&{&&&&&&&&&&&&&&&&&csn&=&AccessController.(&&&&&&&&&&&&&&&&&&&&new&("file.encoding"));&&&&&&&&&&&&&&&&&cs&=&(csn);&&&&&&&&&&&&&&&&if&(cs&!=&null)&&&&&&&&&&&&&&&&&&&&&=&cs;&&&&&&&&&&&&&&&&else&&&&&&&&&&&&&&&&&&&&&=&("UTF-8");&&&&&&&&&&&&}&&&&&&&&}&&&&&&&&return&;&&&&}&&&&&&&&private&final&&;&&&&&&&&&&&&&&private&final&[]&;&&&&&&&&&private&&&=&null;&&&& Initializes a new charset with the given canonical name and alias
&&&&protected&(&canonicalName,&[]&aliases)&{&&&&&&&&(canonicalName);&&&&&&&&[]&as&=&(aliases&==&null)&?&new&[0]&:&aliases;&&&&&&&&for&(int&i&=&0;&i&&&as.length;&i++)&&&&&&&&&&&&(as[i]);&&&&&&&&this.&=&canonicalName;&&&&&&&&this.&=&as;&&&&}&&&& Returns this charset&s canonical name.
&&&&public&final&&()&{&&&&&&&&return&;&&&&}&&&& Returns a set containing this charset&s aliases.
&&&&public&final&&>&()&{&&&&&&&&if&(&!=&null)&&&&&&&&&&&&return&;&&&&&&&&int&n&=&.;&&&&&&&&&hs&=&new&(n);&&&&&&&&for&(int&i&=&0;&i&&&n;&i++)&&&&&&&&&&&&hs.([i]);&&&&&&&&&=&Collections.(hs);&&&&&&&&return&;&&&&}&&&& 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.
&&&&public&&()&{&&&&&&&&return&;&&&&}&&&& Tells whether or not this charset is registered in the IANA Charset
&&&&public&final&boolean&()&{&&&&&&&&return&!.("X-")&&&&!.("x-");&&&&}&&&& 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.
&&&&public&&(&locale)&{&&&&&&&&return&;&&&&}&&&& 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
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
conta if it returns false, however, then
it is not necessarily the case that the given charset is not contained
in this charset.
&&&&public&abstract&boolean&(&cs);&&&& Constructs a new decoder for this charset.
&&&&public&abstract&&();&&&& Constructs a new encoder for this charset.
&&&&public&abstract&&();&&&& 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
&&&&public&boolean&()&{&&&&&&&&return&true;&&&&}&&&& 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.
to detect such sequences, use the
method directly.
&&&&public&final&&(&bb)&{&&&&&&&&try&{&&&&&&&&&&&&return&ThreadLocalCoders.(this)&&&&&&&&&&&&&&&&.(.)&&&&&&&&&&&&&&&&.(.)&&&&&&&&&&&&&&&&.(bb);&&&&&&&&}&catch&(&x)&{&&&&&&&&&&&&throw&new&(x);&&&&&&&&&&&&&&&&&}&&&&}&&&& Convenience method that encodes Unicode characters into bytes in this
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
method directly.
&&&&public&final&&(&cb)&{&&&&&&&&try&{&&&&&&&&&&&&return&ThreadLocalCoders.(this)&&&&&&&&&&&&&&&&.(.)&&&&&&&&&&&&&&&&.(.)&&&&&&&&&&&&&&&&.(cb);&&&&&&&&}&catch&(&x)&{&&&&&&&&&&&&throw&new&(x);&&&&&&&&&&&&&&&&&}&&&&}&&&& 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));
&&&&public&final&&(&str)&{&&&&&&&&return&(CharBuffer.(str));&&&&}&&&& Compares this charset to another.
Charsets are ordered by their canonical names, without regard to
&&&&public&final&int&(&that)&{&&&&&&&&return&(().(that.()));&&&&}&&&& Computes a hashcode for this charset.
&&&&public&final&int&()&{&&&&&&&&return&().();&&&&}&&&& Tells whether or not this object is equal to another.
Two charsets are equal if, and only if, they have the same canonical
A charset is never equal to any other type of object.
&&&&public&final&boolean&(&ob)&{&&&&&&&&if&(!(ob&instanceof&))&&&&&&&&&&&&return&false;&&&&&&&&if&(this&==&ob)&&&&&&&&&&&&return&true;&&&&&&&&return&.((()ob).());&&&&}&&&& Returns a string describing this charset.
&&&&public&final&&()&{&&&&&&&&return&();&&&&}}
&java.nio.charset
<div class="gae-status" id="gae-status-$java$root@jdk$openjdk@6-b14@java$nio$charset@Charset@(java.lang.String,java.lang.String[])">
New to GrepCode? Check out our

我要回帖

更多关于 java.nio.charset 的文章

 

随机推荐