From 886ae611134e91b254da653eac6b48dc80442f33 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Thu, 8 Oct 2009 12:52:15 +0000 Subject: [PATCH] LUCENE-1959: reuse the copy buffer git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@823155 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/lucene/index/IndexSplitter.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java b/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java index 3683d9ceb4a..0971b31c915 100644 --- a/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java +++ b/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java @@ -149,13 +149,14 @@ public class IndexSplitter { // System.out.println("destDir:"+destDir.getAbsolutePath()); } + private static final byte[] copyBuffer = new byte[32*1024]; + private static void copyFile(File src, File dst) throws IOException { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); - byte[] buf = new byte[32*1024]; int len; - while ((len = in.read(buf)) > 0) { - out.write(buf, 0, len); + while ((len = in.read(copyBuffer)) > 0) { + out.write(copyBuffer, 0, len); } in.close(); out.close();