Java Doc for CoderResult.java in  » 6.0-JDK-Core » io-nio » java » nio » charset » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » io nio » java.nio.charset 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.nio.charset.CoderResult

CoderResult
public class CoderResult (Code)
A description of the result state of a coder.

A charset coder, that is, either a decoder or an encoder, consumes bytes (or characters) from an input buffer, translates them, and writes the resulting characters (or bytes) to an output buffer. A coding process terminates for one of four categories of reasons, which are described by instances of this class:

  • Underflow is reported when there is no more input to be processed, or there is insufficient input and additional input is required. This condition is represented by the unique result object CoderResult.UNDERFLOW , whose CoderResult.isUnderflow() isUnderflow method returns true.

  • Overflow is reported when there is insufficient room remaining in the output buffer. This condition is represented by the unique result object CoderResult.OVERFLOW , whose CoderResult.isOverflow()isOverflow method returns true.

  • A malformed-input error is reported when a sequence of input units is not well-formed. Such errors are described by instances of this class whose CoderResult.isMalformed() isMalformed method returns true and whose CoderResult.length() length method returns the length of the malformed sequence. There is one unique instance of this class for all malformed-input errors of a given length.

  • An unmappable-character error is reported when a sequence of input units denotes a character that cannot be represented in the output charset. Such errors are described by instances of this class whose CoderResult.isUnmappable() isUnmappable method returns true and whose CoderResult.length() length method returns the length of the input sequence denoting the unmappable character. There is one unique instance of this class for all unmappable-character errors of a given length.

For convenience, the CoderResult.isError() isError method returns true for result objects that describe malformed-input and unmappable-character errors but false for those that describe underflow or overflow conditions.


author:
   Mark Reinhold
author:
   JSR-51 Expert Group
version:
   1.15, 07/05/05
since:
   1.4


Field Summary
final public static  CoderResultOVERFLOW
     Result object indicating overflow, meaning that there is insufficient room in the output buffer.
final public static  CoderResultUNDERFLOW
     Result object indicating underflow, meaning that either the input buffer has been completely consumed or, if the input buffer is not yet empty, that additional input is required.


Method Summary
public  booleanisError()
     Tells whether or not this object describes an error condition.
public  booleanisMalformed()
     Tells whether or not this object describes a malformed-input error.
public  booleanisOverflow()
     Tells whether or not this object describes an overflow condition.
public  booleanisUnderflow()
     Tells whether or not this object describes an underflow condition.
public  booleanisUnmappable()
     Tells whether or not this object describes an unmappable-character error.
public  intlength()
     Returns the length of the erroneous input described by this object  (optional operation).
public static  CoderResultmalformedForLength(int length)
     Static factory method that returns the unique object describing a malformed-input error of the given length.
public  voidthrowException()
     Throws an exception appropriate to the result described by this object.
public  StringtoString()
     Returns a string describing this coder result.
public static  CoderResultunmappableForLength(int length)
     Static factory method that returns the unique result object describing an unmappable-character error of the given length.

Field Detail
OVERFLOW
final public static CoderResult OVERFLOW(Code)
Result object indicating overflow, meaning that there is insufficient room in the output buffer.




UNDERFLOW
final public static CoderResult UNDERFLOW(Code)
Result object indicating underflow, meaning that either the input buffer has been completely consumed or, if the input buffer is not yet empty, that additional input is required.






Method Detail
isError
public boolean isError()(Code)
Tells whether or not this object describes an error condition.

true if, and only if, this object denotes either amalformed-input error or an unmappable-character error



isMalformed
public boolean isMalformed()(Code)
Tells whether or not this object describes a malformed-input error.

true if, and only if, this object denotes amalformed-input error



isOverflow
public boolean isOverflow()(Code)
Tells whether or not this object describes an overflow condition.

true if, and only if, this object denotes overflow



isUnderflow
public boolean isUnderflow()(Code)
Tells whether or not this object describes an underflow condition.

true if, and only if, this object denotes underflow



isUnmappable
public boolean isUnmappable()(Code)
Tells whether or not this object describes an unmappable-character error.

true if, and only if, this object denotes anunmappable-character error



length
public int length()(Code)
Returns the length of the erroneous input described by this object  (optional operation).

The length of the erroneous input, a positive integer
throws:
  UnsupportedOperationException - If this object does not describe an error condition, that is,if the CoderResult.isError() isError does not return true



malformedForLength
public static CoderResult malformedForLength(int length)(Code)
Static factory method that returns the unique object describing a malformed-input error of the given length.

The requested coder-result object



throwException
public void throwException() throws CharacterCodingException(Code)
Throws an exception appropriate to the result described by this object.


throws:
  BufferUnderflowException - If this object is CoderResult.UNDERFLOW
throws:
  BufferOverflowException - If this object is CoderResult.OVERFLOW
throws:
  MalformedInputException - If this object represents a malformed-input error; theexception's length value will be that of this object
throws:
  UnmappableCharacterException - If this object represents an unmappable-character error; theexceptions length value will be that of this object



toString
public String toString()(Code)
Returns a string describing this coder result. A descriptive string



unmappableForLength
public static CoderResult unmappableForLength(int length)(Code)
Static factory method that returns the unique result object describing an unmappable-character error of the given length.

The requested coder-result object



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) 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.