APISonar


com.taobao.metamorphosis.utils.codec.CodecBuilder.Codec_Type.JAVA

> com > taobao > metamorphosis > utils > codec > CodecBuilder > Codec_Type > JAVA
com APIs taobao APIs metamorphosis APIs utils APIs codec APIs CodecBuilder APIs Codec_Type APIs JAVA APIs

Example 1
public void testJavaEncoder() throws Exception {
        final Serializer encoder = CodecBuilder.buildSerializer(Codec_Type.JAVA);
        byte buf[] = null;

        for (int i = 0; i < 100000; i++) {
            buf = encoder.encodeObject(this.msg);
        }

        Assert.assertTrue(buf != null && buf.length > 0);
    }
Example 2
public void testJavaDecoder() throws Exception {
        final Serializer encoder = CodecBuilder.buildSerializer(Codec_Type.JAVA);
        final Deserializer decoder = CodecBuilder.buildDeserializer(Codec_Type.JAVA);
        final byte buf[] = encoder.encodeObject(this.msg);
        final Message entity1 = (Message) decoder.decodeObject(buf);

        Assert.assertEquals(this.msg, entity1);
    }