jremote jbase5.2.1

com.jbase.jremote.io.charset
Class JbasePrivateUseCharsetDecoder

java.lang.Object
  extended by java.nio.charset.CharsetDecoder
      extended by com.jbase.jremote.io.charset.JbasePrivateUseCharsetDecoder

public class JbasePrivateUseCharsetDecoder
extends CharsetDecoder

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 JbasePrivateUseCharsetDecoder(JbasePrivateUseCharset charset, CharsetDecoder baseDecoder)
               
     
    Method Summary
    protected  ByteBuffer checkBuffer(ByteBuffer buffer, int newDataLength)
               
    protected  CoderResult decodeLoop(ByteBuffer inBytesBuffer, CharBuffer outCharBuffer)
              Convert the incoming jBASE bytes into Unicode char buffer
    protected  void implOnMalformedInput(CodingErrorAction newAction)
               
    protected  void implOnUnmappableCharacter(CodingErrorAction newAction)
               
    protected  void implReplaceWith(String newReplacement)
               
     
    Methods inherited from class java.nio.charset.CharsetDecoder
    averageCharsPerByte, charset, decode, decode, detectedCharset, flush, implFlush, implReset, isAutoDetecting, isCharsetDetected, malformedInputAction, maxCharsPerByte, 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

    JbasePrivateUseCharsetDecoder

    protected JbasePrivateUseCharsetDecoder(JbasePrivateUseCharset charset,
                                            CharsetDecoder baseDecoder)
    Method Detail

    implOnMalformedInput

    protected void implOnMalformedInput(CodingErrorAction newAction)
    Overrides:
    implOnMalformedInput in class CharsetDecoder

    implOnUnmappableCharacter

    protected void implOnUnmappableCharacter(CodingErrorAction newAction)
    Overrides:
    implOnUnmappableCharacter in class CharsetDecoder

    implReplaceWith

    protected void implReplaceWith(String newReplacement)
    Overrides:
    implReplaceWith in class CharsetDecoder

    decodeLoop

    protected CoderResult decodeLoop(ByteBuffer inBytesBuffer,
                                     CharBuffer outCharBuffer)
    Convert the incoming jBASE bytes into Unicode char buffer

    Specified by:
    decodeLoop in class CharsetDecoder

    checkBuffer

    protected ByteBuffer checkBuffer(ByteBuffer buffer,
                                     int newDataLength)

    jremote jbase5.2.1

    Copyright © 2016 TEMENOS. All Rights Reserved.