Use array.clone() instead of manual array creation
This commit is contained in:
committed by
Juergen Hoeller
parent
f61d728db9
commit
f2b3953d76
@@ -206,9 +206,7 @@ public class FastByteArrayOutputStream extends OutputStream {
|
||||
*/
|
||||
public byte[] toByteArray() {
|
||||
byte[] bytesUnsafe = toByteArrayUnsafe();
|
||||
byte[] ret = new byte[bytesUnsafe.length];
|
||||
System.arraycopy(bytesUnsafe, 0, ret, 0, bytesUnsafe.length);
|
||||
return ret;
|
||||
return bytesUnsafe.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user