Here you can find the source of flipToFlush(ByteBuffer buffer, int position)
Parameter | Description |
---|---|
buffer | the buffer to be flipped |
position | The position of valid data to flip to. This should be the return value of the previous call to #flipToFill(ByteBuffer) |
public static void flipToFlush(ByteBuffer buffer, int position)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import java.nio.ByteBuffer; public class Main { /** Flip the buffer to Flush mode. * The limit is set to the first unused byte(the old position) and * the position is set to the passed position. * <p>//from w w w .j a va 2 s.c om * This method is used as a replacement of {@link Buffer#flip()}. * @param buffer the buffer to be flipped * @param position The position of valid data to flip to. This should * be the return value of the previous call to {@link #flipToFill(ByteBuffer)} */ public static void flipToFlush(ByteBuffer buffer, int position) { buffer.limit(buffer.position()); buffer.position(position); } }