Here you can find the source of getByteBuffer(ByteBuffer source, int count)
Parameter | Description |
---|---|
source | a parameter |
count | a parameter |
public static ByteBuffer getByteBuffer(ByteBuffer source, int count)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; import java.nio.ByteOrder; public class Main { /**//ww w . ja va 2 s .co m * Please note that this moves the source buffer forward. * * @param source * @param count * @return */ public static ByteBuffer getByteBuffer(ByteBuffer source, int count) { byte[] data = new byte[count]; source.get(data); ByteBuffer result = ByteBuffer.wrap(data); result.order(source.order()); return result; } public static ByteBuffer getByteBuffer(ByteBuffer source, int count, ByteOrder order) { byte[] data = new byte[count]; source.get(data); ByteBuffer result = ByteBuffer.wrap(data); result.order(order); return result; } }