public <T> T read(byte[] data, int offset, int length, Class<T> type) {
        final Asn1Entity entity = type.getAnnotation(Asn1Entity.class);
        if (entity == null) {
            throw new Asn1Exception("Class should have Asn1Entity annotation");
        }

        final boolean tlv = entity.tagNo() != 0;
        try (final Asn1ObjectInputStream in = new Asn1ObjectInputStream(data, offset, length, tlv)) {
            if (tlv && in.tagNo != entity.tagNo()) {
                throw new Asn1Exception("Tag %x does not match, expected %x", in.tagNo, entity.tagNo());
            }
            return readValue(in, entity.converter(), type);
        }
    }
@Test
    public void shouldSetRawIfAsn1RawIsImplemented() {
        final byte[] data = new byte[] { 0x30, 3, 0x02, 1, 31 };
        assertArrayEquals(data, mapper.read(data, RawObj.class).raw);
    }