Package info.archinnov.achilles.internal.metadata.codec

Examples of info.archinnov.achilles.internal.metadata.codec.ByteArrayPrimitiveCodec


        log.debug("Create simple codec for java type {}", type);
        Codec codec;
        if (Byte.class.isAssignableFrom(type) || byte.class.isAssignableFrom(type)) {
            codec = new ByteCodec();
        } else if (byte[].class.isAssignableFrom(type)) {
            codec = new ByteArrayPrimitiveCodec();
        } else if (Byte[].class.isAssignableFrom(type)) {
            codec = new ByteArrayCodec();
        } else if (PropertyParser.isAssignableFromNativeType(type)) {
            codec = new NativeCodec<Object>(type);
        } else if (type.isEnum()) {
View Full Code Here


    public void should_encoded_and_decode() throws Exception {
        //Given
        byte[] byteArray = new byte[]{(byte)2, (byte)5};
        ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[]{(byte) 2, (byte) 5});

        ByteArrayPrimitiveCodec codec = new ByteArrayPrimitiveCodec();

        //When
        ByteBuffer encoded = codec.encode(byteArray);
        byte[] decoded = codec.decode(byteBuffer);

        //Then
        assertThat(encoded.array()).contains((byte) 2, (byte) 5);
        assertThat(decoded).contains((byte)2, (byte)5);
    }
View Full Code Here

TOP

Related Classes of info.archinnov.achilles.internal.metadata.codec.ByteArrayPrimitiveCodec

Copyright © 2018 www.massapicom. 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.