lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r823155 - /lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java
Date Thu, 08 Oct 2009 12:52:16 GMT
Author: mikemccand
Date: Thu Oct  8 12:52:15 2009
New Revision: 823155

URL: http://svn.apache.org/viewvc?rev=823155&view=rev
Log:
LUCENE-1959: reuse the copy buffer

Modified:
    lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java

Modified: lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java?rev=823155&r1=823154&r2=823155&view=diff
==============================================================================
--- lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java (original)
+++ lucene/java/trunk/contrib/misc/src/java/org/apache/lucene/index/IndexSplitter.java Thu
Oct  8 12:52:15 2009
@@ -149,13 +149,14 @@
     // 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();



Mime
View raw message