Apache Lucene open-source search software
LUCENE-3239: remove use of slow Arrays.copyOf
Robert Muir295706f9f899
diff --git a/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java b/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.javaindex 5345e433a5d..cc62405793c 100644--- a/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java+++ b/modules/facet/src/java/org/apache/lucene/util/UnsafeByteArrayOutputStream.java@@ -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;}/**