another Arrays.copyOf case
@@ -515,9 +515,7 @@ public void setExtraFields(final ZipExtraField[] fields) {
}
private ZipExtraField[] copyOf(final ZipExtraField[] src, final int length) {
- final ZipExtraField[] cpy = new ZipExtraField[length];
- System.arraycopy(src, 0, cpy, 0, Math.min(src.length, length));
- return cpy;
+ return Arrays.copyOf(src, length);
}
private ZipExtraField[] getMergedFields() {
@@ -821,9 +819,7 @@ protected void setName(final String name, final byte[] rawName) {
*/
public byte[] getRawName() {
if (rawName != null) {
- final byte[] b = new byte[rawName.length];
- System.arraycopy(rawName, 0, b, 0, rawName.length);
- return b;
+ return Arrays.copyOf(rawName, rawName.length);
}
return null;
}
