Here you can find the source of cloneSection(ByteBuffer source, int start, int count)
public static ByteBuffer cloneSection(ByteBuffer source, int start, int count)
//package com.java2s; //License from project: Open Source License import java.nio.ByteBuffer; public class Main { public static ByteBuffer cloneSection(ByteBuffer source, int start, int count) { int oldPosition = source.position(); source.position(start);//www . j av a 2 s. c om ByteBuffer result = source.slice(); result.order(source.order()); result.limit(count); source.position(oldPosition); return result; } }