Java ByteBuffer Clone cloneSection(ByteBuffer source, int start, int count)

Here you can find the source of cloneSection(ByteBuffer source, int start, int count)

Description

clone Section

License

Open Source License

Declaration

public static ByteBuffer cloneSection(ByteBuffer source, int start,
            int count) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer cloneSection(ByteBuffer source, int start,
            int count) {
        int oldPosition = source.position();
        source.position(start);//www . j  av a  2 s. c  om
        ByteBuffer result = source.slice();
        result.order(source.order());
        result.limit(count);
        source.position(oldPosition);
        return result;
    }
}

Related

  1. cloneByteBuffer(ByteBuffer buf)
  2. cloneByteBuffer(ByteBuffer buf)
  3. cloneByteBufferList(List source)
  4. cloneByteBufferList(List source)
  5. cloneOnHeap(final ByteBuffer buf)