Java Doc for ByteToCharConverter.java in  » 6.0-JDK-Modules » j2me » sun » io » 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 » 6.0 JDK Modules » j2me » sun.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   sun.io.ByteToCharConverter

All known Subclasses:   sun.io.ByteToCharISO8859_1,  sun.io.ByteToCharDBCS_ASCII,  sun.io.ByteToCharSingleByte,  sun.io.ByteToCharASCII,  sun.io.ByteToCharCp33722,  sun.io.ByteToCharDBCS_EBCDIC,  sun.io.ByteToCharISO2022,  sun.io.ByteToCharDoubleByte,  sun.io.ByteToCharEUC,  sun.io.ByteToCharUnicode,  sun.io.ByteToCharUTF8,  sun.io.ByteToCharEUC_TW,  sun.io.ByteToCharJISAutoDetect,  sun.io.ByteToCharCp964,
ByteToCharConverter
abstract public class ByteToCharConverter (Code)
An abstract base class for subclasses which convert character data in an external encoding into Unicode characters.
author:
   Asmus Freytag
author:
   Lloyd Honomichl


Field Summary
protected  intbadInputLength
    
protected  intbyteOff
    
protected  intcharOff
    
protected  char[]subChars
    
protected  booleansubMode
    


Method Summary
abstract public  intconvert(byte[] input, int inStart, int inEnd, char[] output, int outStart, int outEnd)
     Converts an array of bytes containing characters in an external encoding into an array of Unicode characters.
public  char[]convertAll(byte input)
     Converts an array of bytes containing characters in an external encoding into an array of Unicode characters.
abstract public  intflush(char[] output, int outStart, int outEnd)
     Writes any remaining output to the output buffer and resets the converter to its initial state.
public  intgetBadInputLength()
     Returns the length, in bytes, of the input which caused a MalformedInputException.
abstract public  StringgetCharacterEncoding()
    
public static  ByteToCharConvertergetConverter(String encoding)
     Returns appropriate ByteToCharConverter subclass instance.
public static  ByteToCharConvertergetDefault()
     Create an instance of the default ByteToCharConverter subclass.
public  intgetMaxCharsPerByte()
     Returns the maximum number of characters needed to convert a byte.
public  intnextByteIndex()
     Returns the index of the byte just past the last byte successfully converted by the previous call to convert.
public  intnextCharIndex()
     Returns the index of the character just past the last character written by the previous call to convert.
abstract public  voidreset()
     Resets converter to its initial state.
public  voidsetSubstitutionChars(char[] c)
    
public  voidsetSubstitutionMode(boolean doSub)
     Sets converter into substitution mode.
public  StringtoString()
    

Field Detail
badInputLength
protected int badInputLength(Code)



byteOff
protected int byteOff(Code)



charOff
protected int charOff(Code)



subChars
protected char[] subChars(Code)



subMode
protected boolean subMode(Code)





Method Detail
convert
abstract public int convert(byte[] input, int inStart, int inEnd, char[] output, int outStart, int outEnd) throws MalformedInputException, UnknownCharacterException, ConversionBufferFullException(Code)
Converts an array of bytes containing characters in an external encoding into an array of Unicode characters. This method allows a buffer by buffer conversion of a data stream. The state of the conversion is saved between calls to convert. Among other things, this means multibyte input sequences can be split between calls. If a call to convert results in an exception, the conversion may be continued by calling convert again with suitably modified parameters. All conversions should be finished with a call to the flush method. the number of bytes written to output.
Parameters:
  input - byte array containing text to be converted.
Parameters:
  inStart - begin conversion at this offset in input array.
Parameters:
  inEnd - stop conversion at this offset in input array (exclusive).
Parameters:
  output - character array to receive conversion result.
Parameters:
  outStart - start writing to output array at this offset.
Parameters:
  outEnd - stop writing to output array at this offset (exclusive).
exception:
  MalformedInputException - if the input buffer contains anysequence of bytes that is illegal for the input character set.
exception:
  UnknownCharacterException - for any character thatthat cannot be converted to Unicode. Thrown only when converter is not in substitution mode.
exception:
  ConversionBufferFullException - if output array is filled priorto converting all the input.



convertAll
public char[] convertAll(byte input) throws MalformedInputException(Code)
Converts an array of bytes containing characters in an external encoding into an array of Unicode characters. Unlike convert, this method does not do incremental conversion. It assumes that the given input array contains all the characters to be converted. The state of the converter is reset at the beginning of this method and is left in the reset state on successful termination. The converter is not reset if an exception is thrown. This allows the caller to determine where the bad input was encountered by calling nextByteIndex.

This method uses substitution mode when performing the conversion. The method setSubstitutionChars may be used to determine what characters are substituted. Even though substitution mode is used, the state of the converter's substitution mode is not changed at the end of this method. an array of chars containing the converted characters.
Parameters:
  input - array containing Unicode characters to be converted.
exception:
  MalformedInputException - if the input buffer contains anysequence of chars that is illegal in the input character encoding.After this exception is thrown,the method nextByteIndex can be called to obtain the index of thefirst invalid input byte and getBadInputLength can be calledto determine the length of the invalid input.
See Also:   ByteToCharConverter.nextByteIndex
See Also:   ByteToCharConverter.setSubstitutionMode
See Also:   sun.io.CharToByteConverter.setSubstitutionBytes(byte[])
See Also:   ByteToCharConverter.getBadInputLength




flush
abstract public int flush(char[] output, int outStart, int outEnd) throws MalformedInputException, ConversionBufferFullException(Code)
Writes any remaining output to the output buffer and resets the converter to its initial state.
Parameters:
  output - char array to receive flushed output.
Parameters:
  outStart - start writing to output array at this offset.
Parameters:
  outEnd - stop writing to output array at this offset (exclusive).
exception:
  MalformedInputException - if the output to be flushed containeda partial or invalid multibyte character sequence. flush willwrite what it can to the output buffer and reset the converter beforethrowing this exception. An additional call to flush is not required.
exception:
  ConversionBufferFullException - if output array is filled before all the output can be flushed. flush will write what it canto the output buffer and remember its state. An additional call toflush with a new output buffer will conclude the operation.



getBadInputLength
public int getBadInputLength()(Code)
Returns the length, in bytes, of the input which caused a MalformedInputException. Always refers to the last MalformedInputException thrown by the converter. If none have ever been thrown, returns 0.



getCharacterEncoding
abstract public String getCharacterEncoding()(Code)
Returns the character set id for the conversion



getConverter
public static ByteToCharConverter getConverter(String encoding) throws UnsupportedEncodingException(Code)
Returns appropriate ByteToCharConverter subclass instance.
Parameters:
  string - represents encoding



getDefault
public static ByteToCharConverter getDefault()(Code)
Create an instance of the default ByteToCharConverter subclass.



getMaxCharsPerByte
public int getMaxCharsPerByte()(Code)
Returns the maximum number of characters needed to convert a byte. Useful for calculating the maximum output buffer size needed for a particular input buffer.



nextByteIndex
public int nextByteIndex()(Code)
Returns the index of the byte just past the last byte successfully converted by the previous call to convert.



nextCharIndex
public int nextCharIndex()(Code)
Returns the index of the character just past the last character written by the previous call to convert.



reset
abstract public void reset()(Code)
Resets converter to its initial state.



setSubstitutionChars
public void setSubstitutionChars(char[] c) throws IllegalArgumentException(Code)
sets the substitution character to use
Parameters:
  c - the substitution character



setSubstitutionMode
public void setSubstitutionMode(boolean doSub)(Code)
Sets converter into substitution mode. In substitution mode, the converter will replace untranslatable characters in the source encoding with the substitution character set by setSubstitionChars. When not in substitution mode, the converter will throw an UnknownCharacterException when it encounters untranslatable input.
Parameters:
  doSub - if true, enable substitution mode.
See Also:   ByteToCharConverter.setSubstitutionChars



toString
public String toString()(Code)
returns a string representation of the character conversion



Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.