Java Doc for Charset.java in  » Apache-Harmony-Java-SE » java-package » java » nio » charset » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.nio.charset 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.nio.charset.Charset

Charset
abstract public class Charset implements Comparable<Charset>(Code)
A charset defines a mapping between a Unicode character sequence and a byte sequence. It facilitate the encoding from a Unicode character sequence into a byte sequence, and the decoding from a byte sequence into a Unicode character sequence.

A charset has a canonical name, which are usually in uppercase. Typically it also has one or more aliases. The name string can only consist of the following characters: '0' - '9', 'A' - 'Z', 'a' - 'z', '.', ':'. '-' and '_'. The first character of the name must be a digit or a letter.

The following charsets should be supported by any java platforms: US-ASCII, ISO-8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-16.

Additional charsets can be made available by configuring one or more charset providers through provider configuration files. Such files are always named as "java.nio.charset.spi.CharsetProvider" and located in the "META-INF/services" sub folder of one or more classpaths. The files should be encoded in "UTF-8". Each line of their content specifies the class name of a charset provider which extends java.nio.spi.CharsetProvider. A line should ends with '\r', '\n' or '\r\n'. Leading and trailing whitespaces are trimmed. Blank lines, and lines (after trimmed) starting with "#" which are regarded as comments, are both ignored. Duplicates of already appeared names are also ignored. Both the configuration files and the provider classes will be loaded using the thread context class loader.

This class is thread-safe.


See Also:   java.nio.charset.spi.CharsetProvider

Inner Class :static class IgnoreCaseComparator implements Comparator<String>


Constructor Summary
protected  Charset(String canonicalName, String[] aliases)
     Constructs a Charset object.

Method Summary
final public  Set<String>aliases()
     Gets the set of this charset's aliases.
public static  SortedMap<String, Charset>availableCharsets()
     Gets a map of all available charsets supported by the runtime.

The returned map contains mappings from canonical names to corresponding instances of Charset.

public  booleancanEncode()
     Answers true if this charset supports encoding, otherwise false.
final public  intcompareTo(Charset charset)
     Compares this charset with the given charset.
abstract public  booleancontains(Charset charset)
     Determines whether this charset is a super set of the given charset.
final public  CharBufferdecode(ByteBuffer buffer)
     Decodes the content of the give byte buffer and outputs to a character buffer that is to be returned.
public static  CharsetdefaultCharset()
     Gets the system default charset from jvm.
public  StringdisplayName()
     Gets the name of this charset for the default locale.
public  StringdisplayName(Locale l)
     Gets the name of this charset for the specified locale.
final public  ByteBufferencode(CharBuffer buffer)
     Encodes the content of the give character buffer and outputs to a byte buffer that is to be returned.
final public  ByteBufferencode(String s)
     Encodes a string and outputs to a byte buffer that is to be returned.
final public  booleanequals(Object obj)
     Determines whether this charset equals to the given object.
public static  CharsetforName(String charsetName)
     Gets a Charset instance for the specified charset name.
final public  inthashCode()
     Gets the hash code of this charset.
final public  booleanisRegistered()
     Answers whether this charset is known to be registered in the IANA Charset Registry.
public static  booleanisSupported(String charsetName)
     Determines whether the specified charset is supported by this runtime.
final public  Stringname()
     Gets the canonical name of this charset.
abstract public  CharsetDecodernewDecoder()
     Gets a new instance of decoder for this charset.
abstract public  CharsetEncodernewEncoder()
     Gets a new instance of encoder for this charset.
final public  StringtoString()
     Gets a string representation of this charset.


Constructor Detail
Charset
protected Charset(String canonicalName, String[] aliases)(Code)
Constructs a Charset object. Duplicated aliases are ignored.
Parameters:
  canonicalName - the canonical name of the charset
Parameters:
  aliases - an array containing all aliases of the charset
throws:
  IllegalCharsetNameException - on an illegal value being supplied for eithercanonicalName or for any element ofaliases.




Method Detail
aliases
final public Set<String> aliases()(Code)
Gets the set of this charset's aliases. an unmodifiable set of this charset's aliases



availableCharsets
public static SortedMap<String, Charset> availableCharsets()(Code)
Gets a map of all available charsets supported by the runtime.

The returned map contains mappings from canonical names to corresponding instances of Charset. The canonical names can be considered as case-insensitive.

an unmodifiable map of all available charsets supported by theruntime



canEncode
public boolean canEncode()(Code)
Answers true if this charset supports encoding, otherwise false. true



compareTo
final public int compareTo(Charset charset)(Code)
Compares this charset with the given charset.
Parameters:
  charset - the given object to be compared with a negative integer if less than the given object, a positiveinteger if larger than it, or 0 if equal to it



contains
abstract public boolean contains(Charset charset)(Code)
Determines whether this charset is a super set of the given charset.
Parameters:
  charset - a given charset true if this charset is a super set of the given charset,otherwise false



decode
final public CharBuffer decode(ByteBuffer buffer)(Code)
Decodes the content of the give byte buffer and outputs to a character buffer that is to be returned.

The default action in case of decoding errors is CodingErrorAction.REPLACE.


Parameters:
  buffer - the byte buffer containing the content to be decoded a character buffer containing the output of the decoding



defaultCharset
public static Charset defaultCharset()(Code)
Gets the system default charset from jvm. the default charset



displayName
public String displayName()(Code)
Gets the name of this charset for the default locale. the name of this charset for the default locale



displayName
public String displayName(Locale l)(Code)
Gets the name of this charset for the specified locale.
Parameters:
  l - a certain locale the name of this charset for the specified locale



encode
final public ByteBuffer encode(CharBuffer buffer)(Code)
Encodes the content of the give character buffer and outputs to a byte buffer that is to be returned.

The default action in case of encoding errors is CodingErrorAction.REPLACE.


Parameters:
  buffer - the character buffer containing the content to be encoded the result of the encoding



encode
final public ByteBuffer encode(String s)(Code)
Encodes a string and outputs to a byte buffer that is to be returned.

The default action in case of encoding errors is CodingErrorAction.REPLACE.


Parameters:
  s - the string to be encoded the result of the encoding



equals
final public boolean equals(Object obj)(Code)
Determines whether this charset equals to the given object. They are considered to be equal if they have the same canonical name.
Parameters:
  obj - the given object to be compared with true if they have the same canonical name, otherwise false



forName
public static Charset forName(String charsetName)(Code)
Gets a Charset instance for the specified charset name.
Parameters:
  charsetName - the name of the charset a Charset instance for the specified charset name
throws:
  IllegalCharsetNameException - If the specified charset name is illegal.
throws:
  UnsupportedCharsetException - If the desired charset is not supported by this runtime.



hashCode
final public int hashCode()(Code)
Gets the hash code of this charset. the hash code of this charset



isRegistered
final public boolean isRegistered()(Code)
Answers whether this charset is known to be registered in the IANA Charset Registry. true if the charset is known to be registered, otherwise returnsfalse.



isSupported
public static boolean isSupported(String charsetName)(Code)
Determines whether the specified charset is supported by this runtime.
Parameters:
  charsetName - the name of the charset true if the specified charset is supported, otherwise false
throws:
  IllegalCharsetNameException - If the specified charset name is illegal.



name
final public String name()(Code)
Gets the canonical name of this charset. this charset's name in canonical form.



newDecoder
abstract public CharsetDecoder newDecoder()(Code)
Gets a new instance of decoder for this charset. a new instance of decoder for this charset



newEncoder
abstract public CharsetEncoder newEncoder()(Code)
Gets a new instance of encoder for this charset. a new instance of encoder for this charset



toString
final public String toString()(Code)
Gets a string representation of this charset. Usually this contains the canonical name of the charset. a string representation of this charset



Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.