Java ByteBuffer Copy copy(ByteBuffer origin, int start, int end)

Here you can find the source of copy(ByteBuffer origin, int start, int end)

Description

copy

License

Apache License

Declaration

public static ByteBuffer copy(ByteBuffer origin, int start, int end) 

Method Source Code

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

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static ByteBuffer copy(ByteBuffer origin, int start, int end) {
        ByteOrder order = origin.order();
        ByteBuffer copy = origin.duplicate();
        copy.position(start);//  w  ww .  j  a  va  2  s .co  m
        copy.limit(end);
        copy = copy.slice();
        copy.order(order);
        return copy;
    }

    public static ByteBuffer copy(ByteBuffer origin, int start) {
        return copy(origin, start, origin.limit());
    }
}

Related

  1. copy(ByteBuffer buf)
  2. copy(ByteBuffer buffer)
  3. copy(ByteBuffer buffer)
  4. copy(ByteBuffer buffer)
  5. copy(ByteBuffer from, ByteBuffer to)
  6. copy(ByteBuffer source)
  7. copy(ByteBuffer source, int byteCount)
  8. copy(ByteBuffer src, ByteBuffer dst)
  9. copy(ByteBuffer src, ByteBuffer dst, int length)