Java Buffer.remaining()
Syntax
Buffer.remaining() has the following syntax.
public final int remaining()
Example
In the following code shows how to use Buffer.remaining() method.
import java.nio.ByteBuffer;
// ww w .j av a 2 s . c o m
public class Main {
public static void main(String[] argv) throws Exception {
ByteBuffer buf = ByteBuffer.allocateDirect(10);
int rem = buf.remaining();
System.out.println(rem);
}
}
The code above generates the following result.