com.jbase.jremote.io.charset
Class JbasePrivateUseCharsetEncoder
java.lang.Object
java.nio.charset.CharsetEncoder
com.jbase.jremote.io.charset.JbasePrivateUseCharsetEncoder
public class JbasePrivateUseCharsetEncoder
- extends 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
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 |
JbasePrivateUseCharsetEncoder
protected JbasePrivateUseCharsetEncoder(JbasePrivateUseCharset charset,
CharsetEncoder baseEncoder)
implOnMalformedInput
protected void implOnMalformedInput(CodingErrorAction newAction)
- Overrides:
implOnMalformedInput
in class CharsetEncoder
implOnUnmappableCharacter
protected void implOnUnmappableCharacter(CodingErrorAction newAction)
- Overrides:
implOnUnmappableCharacter
in class CharsetEncoder
implReplaceWith
protected void implReplaceWith(byte[] newReplacement)
- Overrides:
implReplaceWith
in class CharsetEncoder
encodeLoop
protected CoderResult encodeLoop(CharBuffer inCharBuffer,
ByteBuffer outByteBuffer)
- Convert the incoming unicode char buffer to a jBASE byte buffer
- Specified by:
encodeLoop
in class CharsetEncoder
Copyright © 2016 TEMENOS. All Rights Reserved.