List of usage examples for java.nio ShortBuffer order
public abstract ByteOrder order();
From source file:Main.java
public static void main(String[] args) { ShortBuffer bb = ShortBuffer.allocate(10); bb.put((short) 100); System.out.println(bb.order()); }
From source file:de.ailis.threedee.utils.BufferUtils.java
/** * Converts the specified short buffer to native endian and returns this new * buffer. If buffer is already in correct endian format then it is returned * right away./*from ww w.ja v a2 s.co m*/ * * @param buffer * The short buffer to convert * @return The converted short buffer or the source buffer if no conversion * is needed */ public static ShortBuffer convertToNativeEndian(final ShortBuffer buffer) { if (buffer.order() == ByteOrder.nativeOrder()) return buffer; final ByteBuffer bytes = ByteBuffer.allocateDirect(buffer.capacity()); bytes.order(ByteOrder.nativeOrder()); final ShortBuffer shorts = bytes.asShortBuffer(); shorts.put(buffer).rewind(); return shorts; }