Java ByteBuffer Get getBuffer(ByteBuffer buffer, int len)

Here you can find the source of getBuffer(ByteBuffer buffer, int len)

Description

Get buffer form buffer

License

Apache License

Parameter

Parameter Description
buffer a parameter
len a parameter

Declaration

public static ByteBuffer getBuffer(ByteBuffer buffer, int len) 

Method Source Code


//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;
    }
}

Related

  1. getBitString(java.nio.ByteBuffer buffer, int lenBits)
  2. getBoolean(ByteBuffer b)
  3. getBoolean(ByteBuffer bb)
  4. getBoolean(ByteBuffer bytes)
  5. getBoolean(java.nio.ByteBuffer buffer)
  6. getBufferBytes(ByteBuffer bb)
  7. getByte(ByteBuffer bb)
  8. getByte(ByteBuffer byteBuffer)
  9. getByteAsShort(java.nio.ByteBuffer buffer)