mirror of https://github.com/apache/lucene.git
LUCENE-3239: remove use of slow Arrays.copyOf
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1141510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b843dfe839
commit
295706f9f8
|
@ -2,7 +2,6 @@ package org.apache.lucene.util;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
|
@ -72,7 +71,11 @@ public class UnsafeByteArrayOutputStream extends OutputStream {
|
|||
}
|
||||
|
||||
private void grow(int newLength) {
|
||||
buffer = Arrays.copyOf(buffer, newLength);
|
||||
// It actually should be: (Java 1.7, when its intrinsic on all machines)
|
||||
// buffer = Arrays.copyOf(buffer, newLength);
|
||||
byte[] newBuffer = new byte[newLength];
|
||||
System.arraycopy(buffer, 0, newBuffer, 0, buffer.length);
|
||||
buffer = newBuffer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue