static <T> Serde<T> usingNativeOrder(final Serde<T> serde) {

        Objects.requireNonNull(serde);
        if (ByteOrder.nativeOrder().equals(JAVA_BYTE_ORDER)) {
            // java byte order matched native so can just use serde as is
            return serde;
        } else {
            return new Serde<T>() {

                @Override
                public T deserialize(final ByteBuffer byteBuffer) {
                    try {
                        byteBuffer.order(ByteOrder.nativeOrder());
                        return serde.deserialize(byteBuffer);

                    } finally {
                        // Ensure we return the byte buffer to default endianness
                        byteBuffer.order(ByteOrder.BIG_ENDIAN);
                    }
                }

                @Override
                public void serialize(final ByteBuffer byteBuffer, final T object) {
                    try {
                        byteBuffer.order(ByteOrder.nativeOrder());
                        serde.serialize(byteBuffer, object);

                    } finally {
                        // Ensure we return the byte buffer to default endianness
                        byteBuffer.order(ByteOrder.BIG_ENDIAN);
                    }
                }

                @Override
                public int getBufferCapacity() {
                    return serde.getBufferCapacity();
                }
            };
        }
    }
Wraps the supplied serde with one that sets the {@link ByteOrder} to native
order then delegates to serde.
All byteBuffers will be returned to {@link ByteOrder#BIG_ENDIAN} after use.
This is useful for MDB_INTEGERKEY mode.
See <a href="https://github.com/lmdbjava/lmdbjava/wiki/Keys#numeric-keys">Numeric Keys</a>
and <a href="https://github.com/lmdbjava/lmdbjava/issues/51">this github issue</a>.
stroom-lmdb/src/main/java/stroom/lmdb/serde/Serde.java