Java examples for java.nio:ByteBuffer Remain
transfer Remaining ByteBuffer
//package com.java2s; import java.nio.ByteBuffer; public class Main { public static int transferRemaining(ByteBuffer src, ByteBuffer trg) { int xfer = Math.min(src.remaining(), trg.remaining()); int oldLimit = src.limit(); src.limit(src.position() + xfer); trg.put(src);/*from w w w . ja v a 2 s. c om*/ src.limit(oldLimit); return xfer; } }