Java examples for java.nio:ByteBuffer
Clear the ByteBuffer to be empty in flush mode.
//package com.java2s; import java.nio.ByteBuffer; public class Main { /** Clear the buffer to be empty in flush mode. * The position and limit are set to 0; * @param buffer The buffer to clear. *///w w w.ja v a2s . c o m public static void clear(ByteBuffer buffer) { if (buffer != null) { buffer.position(0); buffer.limit(0); } } }