Examples of maxCharsPerByte()


Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

    public void test_error_0() throws Exception {
        byte[] bytes = decodeHex("C2FF".toCharArray());

        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);

        CharBuffer charBuffer = CharBuffer.wrap(chars);

        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

   
    public void test_error_2() throws Exception {
        byte[] bytes = decodeHex("F0A4ADFF".toCharArray());

        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);

        CharBuffer charBuffer = CharBuffer.wrap(chars);

        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

   
    public void test_error_3() throws Exception {
        byte[] bytes = decodeHex("E280FF".toCharArray());

        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);

        CharBuffer charBuffer = CharBuffer.wrap(chars);

        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

   
    public void test_error_4() throws Exception {
        byte[] bytes = decodeHex("80".toCharArray());
       
        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);
       
        CharBuffer charBuffer = CharBuffer.wrap(chars);
       
        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

   
    public void test_error_5() throws Exception {
        byte[] bytes = decodeHex("FBBBF0".toCharArray());
       
        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);
       
        CharBuffer charBuffer = CharBuffer.wrap(chars);
       
        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

   
    public void test_error_6() throws Exception {
        byte[] bytes = decodeHex("FCBBBF".toCharArray());
       
        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);
       
        CharBuffer charBuffer = CharBuffer.wrap(chars);
       
        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

    public void test_error_0() throws Exception {
        byte[] bytes = decodeHex("FBB0B0B0B0B0".toCharArray());

        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);

        CharBuffer charBuffer = CharBuffer.wrap(chars);

        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

    public void test_error_1() throws Exception {
        byte[] bytes = decodeHex("FCB0B0B0B0B0".toCharArray());

        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);

        CharBuffer charBuffer = CharBuffer.wrap(chars);

        Exception error = null;
View Full Code Here

Examples of com.alibaba.fastjson.util.UTF8Decoder.maxCharsPerByte()

    public void test_error_2() throws Exception {
        byte[] bytes = decodeHex("C0".toCharArray());

        UTF8Decoder charsetDecoder = new UTF8Decoder();
        int scaleLength = (int) (bytes.length * (double) charsetDecoder.maxCharsPerByte());
        char[] chars = ThreadLocalCache.getChars(scaleLength);

        CharBuffer charBuffer = CharBuffer.wrap(chars);

        Exception error = null;
View Full Code Here

Examples of java.nio.charset.CharsetDecoder.maxCharsPerByte()

        }

        // slightly overestimate the buffer size to avoid reallocation.
        float factor =
            decoder.averageCharsPerByte() * 0.8f +
            decoder.maxCharsPerByte() * 0.2f;
        CharBuffer dest = CharBuffer.
            allocate(10 + (int)(inbuf.remaining()*factor));

        while (true) {
            CoderResult result = decoder.decode(inbuf, dest, true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.