Here you can find the source of createByteBuffer(byte[] data)
Parameter | Description |
---|---|
data | The data. |
public static ByteBuffer createByteBuffer(byte[] data)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { /** The default byte order. */ public static final ByteOrder DEFAULT_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN; /**/*w w w.j a v a2s. c o m*/ * Create a ByteBuffer for the provided data using the default byte order ({@link DataTypeTestUtil#DEFAULT_BYTE_ORDER}). * * @param data The data. * * @return The ByteBuffer for the data. */ public static ByteBuffer createByteBuffer(byte[] data) { return createByteBuffer(data, DEFAULT_BYTE_ORDER); } /** * Create a ByteBuffer for the provided data using the provided byte order. * * @param data The data. * @param byteOrder The byte order. * * @return The ByteBuffer for the data. */ public static ByteBuffer createByteBuffer(byte[] data, ByteOrder byteOrder) { return ByteBuffer.wrap(data).order(byteOrder); } }