com.jbase.jremote.io.charset
Class JbasePrivateUseCharsetDecoder
java.lang.Object
java.nio.charset.CharsetDecoder
com.jbase.jremote.io.charset.JbasePrivateUseCharsetDecoder
public class JbasePrivateUseCharsetDecoder
- extends java.nio.charset.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
Method Summary |
protected java.nio.ByteBuffer |
checkBuffer(java.nio.ByteBuffer buffer,
int newDataLength)
|
protected java.nio.charset.CoderResult |
decodeLoop(java.nio.ByteBuffer inBytesBuffer,
java.nio.CharBuffer outCharBuffer)
Convert the incoming jBASE bytes into Unicode char buffer |
protected void |
implOnMalformedInput(java.nio.charset.CodingErrorAction newAction)
|
protected void |
implOnUnmappableCharacter(java.nio.charset.CodingErrorAction newAction)
|
protected void |
implReplaceWith(java.lang.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 |
JbasePrivateUseCharsetDecoder
protected JbasePrivateUseCharsetDecoder(JbasePrivateUseCharset charset,
java.nio.charset.CharsetDecoder baseDecoder)
implOnMalformedInput
protected void implOnMalformedInput(java.nio.charset.CodingErrorAction newAction)
- Overrides:
implOnMalformedInput
in class java.nio.charset.CharsetDecoder
implOnUnmappableCharacter
protected void implOnUnmappableCharacter(java.nio.charset.CodingErrorAction newAction)
- Overrides:
implOnUnmappableCharacter
in class java.nio.charset.CharsetDecoder
implReplaceWith
protected void implReplaceWith(java.lang.String newReplacement)
- Overrides:
implReplaceWith
in class java.nio.charset.CharsetDecoder
decodeLoop
protected java.nio.charset.CoderResult decodeLoop(java.nio.ByteBuffer inBytesBuffer,
java.nio.CharBuffer outCharBuffer)
- Convert the incoming jBASE bytes into Unicode char buffer
- Specified by:
decodeLoop
in class java.nio.charset.CharsetDecoder
checkBuffer
protected java.nio.ByteBuffer checkBuffer(java.nio.ByteBuffer buffer,
int newDataLength)
Copyright © 2010 TEMENOS. All Rights Reserved.