Java Doc for CharsetEncoderICU.java in  » Internationalization-Localization » icu4j » com » ibm » icu » 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 » Internationalization Localization » icu4j » com.ibm.icu.charset 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.ibm.icu.charset.CharsetEncoderICU

CharsetEncoderICU
abstract public class CharsetEncoderICU extends CharsetEncoder (Code)
An abstract class that provides framework methods of decoding operations for concrete subclasses. In the future this class will contain API that will implement converter sematics of ICU4C.


Field Summary
 byte[]errorBuffer
    
 interrorBufferLength
    
 CharsetCallback.EncoderfromCharErrorBehaviour
    
 intfromUChar32
    
 ObjectfromUContext
    
 intfromUnicodeStatus
    
 char[]invalidUCharBuffer
    
 intinvalidUCharLength
    
 char[]preFromUArray
    
 intpreFromUBegin
    
 intpreFromUFirstCP
    
 intpreFromULength
    
 booleanuseSubChar1
    

Constructor Summary
 CharsetEncoderICU(CharsetICU cs, byte[] replacement)
    

Method Summary
public  booleancanEncode(int codepoint)
     Ascertains if a given Unicode code point (32bit value for handling surrogates) can be converted to the target encoding.
 CoderResultcbFromUWriteSub(CharsetEncoderICU encoder, CharBuffer source, ByteBuffer target, IntBuffer offsets)
     Write the codepage substitution character.
final  CoderResultencode(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)
     Implements ICU semantics for encoding the buffer
Parameters:
  source - The input character buffer
Parameters:
  target - The output byte buffer
Parameters:
  offsets -
Parameters:
  flush - true if, and only if, the invoker can provide noadditional input bytes beyond those in the given buffer.
protected  CoderResultencodeLoop(CharBuffer in, ByteBuffer out)
     Encodes one or more chars.
abstract  CoderResultencodeLoop(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)
    
 intfromUCountPending()
     Returns the number of chars held in the converter's internal state because more input is needed for completing the conversion.
final static  CoderResultfromUWriteBytes(CharsetEncoderICU cnv, byte[] bytesArray, int bytesBegin, int bytesLength, ByteBuffer out, IntBuffer offsets, int sourceIndex)
     Writes out the specified output bytes to the target byte buffer or to converter internal buffers.
final  CoderResultfromUnicodeWithCallback(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)
     Implementation note for m:n conversions While collecting source units to find the longest match for m:n conversion, some source units may need to be stored for a partial match.
protected  CoderResultimplFlush(ByteBuffer out)
     Flushes any characters saved in the converter's internal buffer and resets the converter.
Parameters:
  out - action to be taken result of flushing action and completes the decoding all input.
protected  voidimplOnMalformedInput(CodingErrorAction newAction)
    
protected  voidimplOnUnmappableCharacter(CodingErrorAction newAction)
    
protected  voidimplReset()
    
public  booleanisLegalReplacement(byte[] repl)
    

Field Detail
errorBuffer
byte[] errorBuffer(Code)



errorBufferLength
int errorBufferLength(Code)



fromCharErrorBehaviour
CharsetCallback.Encoder fromCharErrorBehaviour(Code)



fromUChar32
int fromUChar32(Code)



fromUContext
Object fromUContext(Code)



fromUnicodeStatus
int fromUnicodeStatus(Code)
these are for encodeLoopICU



invalidUCharBuffer
char[] invalidUCharBuffer(Code)



invalidUCharLength
int invalidUCharLength(Code)



preFromUArray
char[] preFromUArray(Code)



preFromUBegin
int preFromUBegin(Code)



preFromUFirstCP
int preFromUFirstCP(Code)



preFromULength
int preFromULength(Code)



useSubChar1
boolean useSubChar1(Code)




Constructor Detail
CharsetEncoderICU
CharsetEncoderICU(CharsetICU cs, byte[] replacement)(Code)
Construcs a new encoder for the given charset
Parameters:
  cs - for which the decoder is created
Parameters:
  replacement - the substitution bytes




Method Detail
canEncode
public boolean canEncode(int codepoint)(Code)
Ascertains if a given Unicode code point (32bit value for handling surrogates) can be converted to the target encoding. If the caller wants to test if a surrogate pair can be converted to target encoding then the responsibility of assembling the int value lies with the caller. For assembling a code point the caller can use UTF16 class of ICU4J and do something like:
 while(i
 or
 
 String src = new String(mySource);
 int i,codepoint;
 boolean passed = false;
 while(i0xfff)? 2:1;
 if(!(CharsetEncoderICU) myConv).canEncode(codepoint)){
 passed = false;
 }
 }
 

Parameters:
  codepoint - Unicode code point as int value true if a character can be converted



cbFromUWriteSub
CoderResult cbFromUWriteSub(CharsetEncoderICU encoder, CharBuffer source, ByteBuffer target, IntBuffer offsets)(Code)
Write the codepage substitution character. Subclasses to override this method. For stateful converters, it is typically necessary to handle this specificially for the converter in order to properly maintain the state.
Parameters:
  source - The input character buffer
Parameters:
  target - The output byte buffer
Parameters:
  offsets - A CoderResult object that contains the error result when an error occurs.



encode
final CoderResult encode(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)(Code)
Implements ICU semantics for encoding the buffer
Parameters:
  source - The input character buffer
Parameters:
  target - The output byte buffer
Parameters:
  offsets -
Parameters:
  flush - true if, and only if, the invoker can provide noadditional input bytes beyond those in the given buffer. A CoderResult object that contains the error result when an error occurs.



encodeLoop
protected CoderResult encodeLoop(CharBuffer in, ByteBuffer out)(Code)
Encodes one or more chars. The default behaviour of the converter is stop and report if an error in input stream is encountered. To set different behaviour use @see CharsetEncoder.onMalformedInput()
Parameters:
  in - buffer to decode
Parameters:
  out - buffer to populate with decoded result result of decoding action. Returns CoderResult.UNDERFLOW if the decodingaction succeeds or more input is needed for completing the decoding action.



encodeLoop
abstract CoderResult encodeLoop(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)(Code)
Implements ICU semantics of buffer management
Parameters:
  source -
Parameters:
  target -
Parameters:
  offsets - A CoderResult object that contains the error result when an error occurs.



fromUCountPending
int fromUCountPending()(Code)
Returns the number of chars held in the converter's internal state because more input is needed for completing the conversion. This function is useful for mapping semantics of ICU's converter interface to those of iconv, and this information is not needed for normal conversion. The number of chars in the state. -1 if an error is encountered.



fromUWriteBytes
final static CoderResult fromUWriteBytes(CharsetEncoderICU cnv, byte[] bytesArray, int bytesBegin, int bytesLength, ByteBuffer out, IntBuffer offsets, int sourceIndex)(Code)
Writes out the specified output bytes to the target byte buffer or to converter internal buffers.
Parameters:
  cnv -
Parameters:
  bytesArray -
Parameters:
  bytesBegin -
Parameters:
  bytesLength -
Parameters:
  out -
Parameters:
  offsets -
Parameters:
  sourceIndex - A CoderResult object that contains the error result when an error occurs.



fromUnicodeWithCallback
final CoderResult fromUnicodeWithCallback(CharBuffer source, ByteBuffer target, IntBuffer offsets, boolean flush)(Code)
Implementation note for m:n conversions While collecting source units to find the longest match for m:n conversion, some source units may need to be stored for a partial match. When a second buffer does not yield a match on all of the previously stored source units, then they must be "replayed", i.e., fed back into the converter. The code relies on the fact that replaying will not nest - converting a replay buffer will not result in a replay. This is because a replay is necessary only after the _continuation_ of a partial match failed, but a replay buffer is converted as a whole. It may result in some of its units being stored again for a partial match, but there will not be a continuation _during_ the replay which could fail. It is conceivable that a callback function could call the converter recursively in a way that causes another replay to be stored, but that would be an error in the callback function. Such violations will cause assertion failures in a debug build, and wrong output, but they will not cause a crash.



implFlush
protected CoderResult implFlush(ByteBuffer out)(Code)
Flushes any characters saved in the converter's internal buffer and resets the converter.
Parameters:
  out - action to be taken result of flushing action and completes the decoding all input. Returns CoderResult.UNDERFLOW if the action succeeds.



implOnMalformedInput
protected void implOnMalformedInput(CodingErrorAction newAction)(Code)
Sets the action to be taken if an illegal sequence is encountered
Parameters:
  newAction - action to be taken
exception:
  IllegalArgumentException -



implOnUnmappableCharacter
protected void implOnUnmappableCharacter(CodingErrorAction newAction)(Code)
Sets the action to be taken if an illegal sequence is encountered
Parameters:
  newAction - action to be taken
exception:
  IllegalArgumentException -



implReset
protected void implReset()(Code)
Resets the from Unicode mode of converter



isLegalReplacement
public boolean isLegalReplacement(byte[] repl)(Code)
Overrides super class method



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