Here you can find the source of from(ByteBuffer buffer, int offset)
public static ByteBuffer from(ByteBuffer buffer, int offset)
//package com.java2s; /**/*from ww w .j a va 2s . co m*/ * This class is part of JCodec ( www.jcodec.org ) This software is distributed * under FreeBSD License * * @author The JCodec project * */ import java.nio.ByteBuffer; public class Main { public static ByteBuffer from(ByteBuffer buffer, int offset) { ByteBuffer dup = buffer.duplicate(); dup.position(dup.position() + offset); return dup; } public static ByteBuffer duplicate(ByteBuffer bb) { ByteBuffer out = ByteBuffer.allocate(bb.remaining()); out.put(bb.duplicate()); out.flip(); return out; } }