Here you can find the source of getBuffer(ByteBuffer buffer, int len)
Parameter | Description |
---|---|
buffer | a parameter |
len | a parameter |
public static ByteBuffer getBuffer(ByteBuffer buffer, int len)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**/*from w w w .ja va 2 s . com*/ * Get buffer form buffer * * @param buffer * @param len * @return */ public static ByteBuffer getBuffer(ByteBuffer buffer, int len) { byte[] des = new byte[len]; buffer.get(des); ByteBuffer buf = ByteBuffer.allocate(len); buf.put(des); buf.flip(); return buf; } }