Java examples for java.nio:ByteBuffer Copy
copy one ByteBuffer to another ByteBuffer
//package com.java2s; import java.nio.ByteBuffer; public class Main { public final static int copy(final ByteBuffer from, final ByteBuffer to) { final int len = from.limit(); return copy(from, 0, to, 0, len); }/*from w w w. ja v a2 s .c o m*/ public final static int copy(final ByteBuffer from, final int offset1, final ByteBuffer to, final int offset2, final int len) { System.arraycopy(from.array(), offset1, to.array(), offset2, len); to.limit(offset2 + len); return len; } }