Package com.alibaba.json.bvt.parser

Source Code of com.alibaba.json.bvt.parser.JSONReaderScannerTest_bytes

package com.alibaba.json.bvt.parser;

import java.io.StringReader;

import org.junit.Assert;

import junit.framework.TestCase;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONReader;

public class JSONReaderScannerTest_bytes extends TestCase {

    public void test_e() throws Exception {
        VO vo = new VO();
        vo.setValue("ABC".getBytes("UTF-8"));
       
        String text = JSON.toJSONString(vo);
       
        JSONReader reader = new JSONReader(new StringReader(text));
        VO vo2 = reader.readObject(VO.class);
        Assert.assertEquals("ABC", new String(vo2.getValue()));
        reader.close();
    }

    public static class VO {

        private byte[] value;

        public byte[] getValue() {
            return value;
        }

        public void setValue(byte[] value) {
            this.value = value;
        }

    }
}
TOP

Related Classes of com.alibaba.json.bvt.parser.JSONReaderScannerTest_bytes

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.