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

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


        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()) {
            codec = createEnumCodec(type, maybeEncoding);
        } else {
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});

        ByteArrayCodec codec = new ByteArrayCodec();

        //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.ByteArrayCodec

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.