Java Byte Array Copy copyByteArray(final byte[] src, byte[] dest, int length)

Here you can find the source of copyByteArray(final byte[] src, byte[] dest, int length)

Description

Same as System.arraycopy(src, 0, dest, 0, length) .

License

BSD License

Parameter

Parameter Description
src the source array.
dest the destination array.
length the number of array elements to be copied.

Declaration

public static void copyByteArray(final byte[] src, byte[] dest, int length) 

Method Source Code

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

public class Main {
    /**/*from w  ww . ja va  2 s . c o m*/
     * Same as {@code System.arraycopy(src, 0, dest, 0, length)}.
     * 
      * @param      src      the source array.
      * @param      dest     the destination array.
      * @param      length   the number of array elements to be copied.
      * @exception  IndexOutOfBoundsException  if copying would cause
      *               access of data outside array bounds.
      * @exception  NullPointerException if either <code>src</code> or
      *               <code>dest</code> is <code>null</code>.
     */
    public static void copyByteArray(final byte[] src, byte[] dest, int length) {
        System.arraycopy(src, 0, dest, 0, length);
    }

    /**
     * Same as {@code copyByteArray(src, dest, src.length)}.
      * @param      src      the source array.
      * @param      dest     the destination array.
      * @exception  IndexOutOfBoundsException  if copying would cause
      *               access of data outside array bounds.
      * @exception  NullPointerException if either <code>src</code> or
      *               <code>dest</code> is <code>null</code>.
     */
    public static void copyByteArray(final byte[] src, byte[] dest) {
        copyByteArray(src, dest, src.length);
    }
}

Related

  1. copyByte(byte[] ASource, int nFrom, int nEnd)
  2. copyByteArray(byte[] array2Copy)
  3. copyByteArray(byte[] source)
  4. copyBytes(byte[] arr, int length)
  5. copyBytes(byte[] dst, int dstPos, int value)
  6. copyBytes(byte[] dstBytes, int dstFrom, byte[] srcBytes, int srcFrom, int len)
  7. copyBytes(byte[] from, byte[] to, int fromIndex)