Java ByteBuffer Copy copyTo(ByteBuffer original, ByteBuffer copy)

Here you can find the source of copyTo(ByteBuffer original, ByteBuffer copy)

Description

copy To

License

Open Source License

Declaration

public static void copyTo(ByteBuffer original, ByteBuffer copy) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    public static void copyTo(ByteBuffer original, ByteBuffer copy) {
        original.rewind();// copy from the beginning
        copy.put(original);/*w w  w .  jav  a  2  s  .  c  o  m*/
        original.rewind();
        // copy.flip();
    }
}

Related

  1. copyFromBufferToBuffer(ByteBuffer out, ByteBuffer in, int sourceOffset, int length)
  2. copyFromBufferToBuffer(ByteBuffer out, ByteBuffer in, int sourceOffset, int length)
  3. copyFromStreamToBuffer(ByteBuffer out, DataInputStream in, int length)
  4. copyOf(ByteBuffer payload)
  5. copyRemaining(ByteBuffer src, ByteBuffer dst)
  6. copyToArray(@Nonnull ByteBuffer data)
  7. copyToHeapBuffer(ByteBuffer src, ByteBuffer dest)
  8. copyToStream(ByteBuffer byteBuffer, OutputStream os)
  9. copyWholeFrame(ByteBuffer srcFrame, ByteBuffer destFrame)