Here you can find the source of increaseByteBuffer(ByteBuffer byteBuffer, int increase)
Parameter | Description |
---|---|
byteBuffer | a parameter |
public static final ByteBuffer increaseByteBuffer(ByteBuffer byteBuffer, int increase)
//package com.java2s; //License from project: Apache License import java.nio.ByteBuffer; public class Main { /**//from w ww. j a v a 2 s .c om * increase ByteBuffer * * @param byteBuffer * @return */ public static final ByteBuffer increaseByteBuffer(ByteBuffer byteBuffer, int increase) { int capacity = byteBuffer.limit() + increase; ByteBuffer result = (byteBuffer.isDirect() ? ByteBuffer.allocateDirect(capacity) : ByteBuffer.allocate(capacity)); result.order(byteBuffer.order()); byteBuffer.flip(); result.put(byteBuffer); return result; } }