jremote jbase5.2.1

com.jbase.jremote.io.charset
Class JbasePrivateUseCharsetEncoder

java.lang.Object
  extended by java.nio.charset.CharsetEncoder
      extended by com.jbase.jremote.io.charset.JbasePrivateUseCharsetEncoder

public class JbasePrivateUseCharsetEncoder
extends java.nio.charset.CharsetEncoder

An engine that can transform a sequence of bytes in a jBASE private use charset into a sequence of sixteen-bit Unicode characters.

The jBASE charset set is very similiar to the UTF-8 charset except for 3 bytes that are used to delimit attributes, values, and subvalues in a dynamic array. These bytes 0xfe, 0xfd, and 0xfc respectively are not used in the UTF-8 charset and are therefore able to be converted bi-directionally with Unicode Private Use Area (U+E000 - U+F8FF) as follows:

  • 0xfe to Unicode code point 0xF8FE. 0xEFA3BE (UTF-8) or 0xF8FE (UTF-16)
  • 0xfd to Unicode code point 0xF8FD. 0xEFA3BD (UTF-8) or 0XF8FD (UTF-16)
  • 0xfc to Unicode code point 0xF8FC. 0xEFA3BC (UTF-8) or 0XF8FC (UTF-16)

    There are several other questions that may be raised when talking about encoding or decoding a charset.
    1. What about existing data containing 0xfe? In jBASE there is no danger of this character being lost or miss converted because this character was always used to delimit an attribute and therefore is not the SMALL ICELANDIC LETTER THORN (LATIN SMALL LETTER THORN) http://www.cs.tut.fi/~jkorpela/latin1/3.html.

    2. Can I convert non jBASE data using this decoder/encoder. No, it will be wrong for the above reason (see question 1) and the reality is you do not want to convert non jBASE data using this decoder / encoder.

    The decoder / encoder may be called zero or more times.

    Author:
    aphethean

    Constructor Summary
    protected JbasePrivateUseCharsetEncoder(JbasePrivateUseCharset charset, java.nio.charset.CharsetEncoder baseEncoder)
               
     
    Method Summary
    protected  java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer inCharBuffer, java.nio.ByteBuffer outByteBuffer)
              Convert the incoming unicode char buffer to a jBASE byte buffer
    protected  void implOnMalformedInput(java.nio.charset.CodingErrorAction newAction)
               
    protected  void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction newAction)
               
    protected  void implReplaceWith(byte[] newReplacement)
               
     
    Methods inherited from class java.nio.charset.CharsetEncoder
    averageBytesPerChar, canEncode, canEncode, charset, encode, encode, flush, implFlush, implReset, isLegalReplacement, malformedInputAction, maxBytesPerChar, onMalformedInput, onUnmappableCharacter, replacement, replaceWith, reset, unmappableCharacterAction
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    JbasePrivateUseCharsetEncoder

    protected JbasePrivateUseCharsetEncoder(JbasePrivateUseCharset charset,
                                            java.nio.charset.CharsetEncoder baseEncoder)
    Method Detail

    implOnMalformedInput

    protected void implOnMalformedInput(java.nio.charset.CodingErrorAction newAction)
    Overrides:
    implOnMalformedInput in class java.nio.charset.CharsetEncoder

    implOnUnmappableCharacter

    protected void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction newAction)
    Overrides:
    implOnUnmappableCharacter in class java.nio.charset.CharsetEncoder

    implReplaceWith

    protected void implReplaceWith(byte[] newReplacement)
    Overrides:
    implReplaceWith in class java.nio.charset.CharsetEncoder

    encodeLoop

    protected java.nio.charset.CoderResult encodeLoop(java.nio.CharBuffer inCharBuffer,
                                                      java.nio.ByteBuffer outByteBuffer)
    Convert the incoming unicode char buffer to a jBASE byte buffer

    Specified by:
    encodeLoop in class java.nio.charset.CharsetEncoder

    jremote jbase5.2.1

    Copyright © 2010 TEMENOS. All Rights Reserved.