Java ByteBuffer Slice slice(ByteBuffer data)

Here you can find the source of slice(ByteBuffer data)

Description

slice

License

Apache License

Declaration

public static ByteBuffer slice(ByteBuffer data) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer slice(ByteBuffer data) {
        if (data.hasRemaining()) {
            byte[] slice = new byte[data.remaining()];
            data.get(slice, 0, data.remaining());
            return ByteBuffer.wrap(slice);
        }/*from  ww w  . j av  a 2s .c om*/
        return null;
    }
}

Related

  1. getSlice(ByteBuffer bb, int offset, int length)
  2. preservingSlice(final ByteBuffer byteBuffer, final int position, final int limit)
  3. slice(ByteBuffer buf, int pos, int limit)
  4. slice(ByteBuffer buf, int start, int end)
  5. slice(final ByteBuffer buffer, final int offset, final int length)
  6. slice(final ByteBuffer buffer, final int position)
  7. sliceBuffer(ByteBuffer byteBuffer, int start, int end)
  8. sliceByteBuffer(ByteBuffer buffer, int position, int length)