List of utility methods to do Array Copy
byte[] | arraycopy(byte[] from, byte[] to) arraycopy System.arraycopy(from, 0, to, 0, from.length);
return to;
|
void | arrayCopy(byte[] src, int srcPos, byte[] dest, int destPos, int length) array Copy if (length - destPos > src.length - srcPos) return; for (int i = destPos, j = srcPos; i < destPos + length; i++, j++) { dest[i] = src[j]; |
byte[] | copyOf(byte[] bytes) copy Of return copyOfRange(bytes, 0, bytes.length);
|
byte[] | copyOfRange(byte[] bytes, int offset, int len) copy Of Range byte[] result = new byte[len]; System.arraycopy(bytes, offset, result, 0, len); return result; |
byte[] | copyOfRange(byte[] original, int from, int to) copy Of Range int newLength = to - from; if (newLength < 0) { throw new IllegalArgumentException(from + " > " + to); byte[] copy = new byte[newLength]; System.arraycopy(original, from, copy, 0, Math.min(original.length - from, newLength)); return copy; ... |
boolean[] | createCopy(boolean[] array, int dataSize, int newLength) create Copy boolean[] newArray = new boolean[newLength]; if (dataSize > 0) { System.arraycopy(array, 0, newArray, 0, dataSize); return newArray; |
byte[] | createCopy(byte[] array, int dataSize, int newLength) create Copy byte[] newArray = new byte[newLength]; if (dataSize > 0) { System.arraycopy(array, 0, newArray, 0, dataSize); return newArray; |
char[] | createCopy(char[] array, int dataSize, int newLength) create Copy char[] newArray = new char[newLength]; if (dataSize > 0) { System.arraycopy(array, 0, newArray, 0, dataSize); return newArray; |
int[] | createCopy(int[] array, int dataSize, int newLength) create Copy int[] newArray = new int[newLength]; if (dataSize > 0) { System.arraycopy(array, 0, newArray, 0, dataSize); return newArray; |
String[] | createCopy(String[] array, int dataSize, int newLength) create Copy String[] newArray = new String[newLength]; if (dataSize > 0) { System.arraycopy(array, 0, newArray, 0, dataSize); return newArray; |