Java ByteBuffer Clear clear(ByteBuffer buffer)

Here you can find the source of clear(ByteBuffer buffer)

Description

Clear the buffer to be empty in flush mode.

License

Open Source License

Parameter

Parameter Description
buffer The buffer to clear.

Declaration

public static void clear(ByteBuffer buffer) 

Method Source Code

//package com.java2s;
//  are made available under the terms of the Eclipse Public License v1.0

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.
     *//*from  ww  w  .j  a  v  a  2  s  . com*/
    public static void clear(ByteBuffer buffer) {
        if (buffer != null) {
            buffer.position(0);
            buffer.limit(0);
        }
    }
}

Related

  1. clear(ByteBuffer b)
  2. clear(ByteBuffer buffer, int position, int length, byte filler)
  3. clear(ByteBuffer[] buffers)
  4. clearAll(ByteBuffer[] buffers)
  5. clearAndEnsureCapacity(ByteBuffer buffer, int elements)