com.ximpleware.transcode
Class UTF8_Coder
java.lang.Object
com.ximpleware.transcode.UTF8_Coder
public class UTF8_Coder
- extends Object
|
Method Summary |
static long |
decode(byte[] input,
int offset)
Decode a UTF-8 char in the input buffer |
static int |
encode(byte[] output,
int offset,
int ch)
Encode a UCS Char to a UTF-8 representation and write it into the output
buffer |
static void |
encodeAndWrite(OutputStream os,
int ch)
|
static int |
getLen(int ch)
Get the length (in UTF-8 representation) of the UCS char at the offset value |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UTF8_Coder
public UTF8_Coder()
encode
public static int encode(byte[] output,
int offset,
int ch)
- Encode a UCS Char to a UTF-8 representation and write it into the output
buffer
- Parameters:
output - the output byte bufferoffset - offset value to which the UTF-8 bytes are writtench - the UCS char to be encoded
- Returns:
- the offset value of the next char to be written
encodeAndWrite
public static final void encodeAndWrite(OutputStream os,
int ch)
throws IOException,
TranscodeException
- Throws:
IOException
TranscodeException
decode
public static long decode(byte[] input,
int offset)
- Decode a UTF-8 char in the input buffer
- Parameters:
input - the byte array containing UTF-8 chars
- Returns:
- a long whose lower 32-bits is the char at the given offset
upper 32-bits is the offset of next char in input
getLen
public static int getLen(int ch)
throws TranscodeException
- Get the length (in UTF-8 representation) of the UCS char at the offset value
- Parameters:
input -
- Returns:
- a long whose upper 32-bits is next offset value
and whose lower 32-bits is length in byte
- Throws:
TranscodeException
Copyright © 2013. All Rights Reserved.