Java ByteBuffer Endian inLittleEndianOrder(ByteBuffer buf)

Here you can find the source of inLittleEndianOrder(ByteBuffer buf)

Description

in Little Endian Order

License

Open Source License

Declaration

public static ByteBuffer inLittleEndianOrder(ByteBuffer buf) 

Method Source Code


//package com.java2s;
/* Partial import of https://github.com/jpountz/lz4-java, Apache 2.0 licensed. */

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static ByteBuffer inLittleEndianOrder(ByteBuffer buf) {
        if (buf.order().equals(ByteOrder.LITTLE_ENDIAN)) {
            return buf;
        } else {/*from   w w  w  .  j  a v  a  2 s.  c om*/
            return buf.duplicate().order(ByteOrder.LITTLE_ENDIAN);
        }
    }
}

Related

  1. convertLittleEndianLong(ByteBuffer buff, int size)
  2. decodeLittleEndianFixedWidthLong(ByteBuffer buffer)
  3. decodeLittleEndianVarInt(ByteBuffer buffer)
  4. extractInt(ByteBuffer header_buf, boolean bigEndian)
  5. extractShort(ByteBuffer buffer, boolean bigEndian)
  6. swapEndian16(ByteBuffer buf)