Java ByteBuffer Resize resizeByteBuffer(ByteBuffer buf, long size)

Here you can find the source of resizeByteBuffer(ByteBuffer buf, long size)

Description

resize Byte Buffer

License

Apache License

Declaration

public static ByteBuffer resizeByteBuffer(ByteBuffer buf, long size) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer resizeByteBuffer(ByteBuffer buf, long size) {
        ByteBuffer ret = ByteBuffer.allocateDirect((int) size);
        if (ret != null) {
            if (null != buf) {
                ret.put(buf);//  w  ww . j a v  a 2  s .  c o m
                ret.flip();
            }
        }
        return ret;
    }
}

Related

  1. increaseByteBuffer(ByteBuffer byteBuffer, int increase)
  2. performResize(BufferedImage source, int newWidth, int newHeight)
  3. resize(ByteBuffer buffer)
  4. resize(ByteBuffer oldBuffer, int newSize)
  5. resizeBuffer(final ByteBuffer in)