mirror of https://github.com/apache/lucene.git
LUCENE-1959: reuse the copy buffer
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@823155 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2fc8e01d9e
commit
886ae61113
|
@ -149,13 +149,14 @@ public class IndexSplitter {
|
||||||
// System.out.println("destDir:"+destDir.getAbsolutePath());
|
// 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 {
|
private static void copyFile(File src, File dst) throws IOException {
|
||||||
InputStream in = new FileInputStream(src);
|
InputStream in = new FileInputStream(src);
|
||||||
OutputStream out = new FileOutputStream(dst);
|
OutputStream out = new FileOutputStream(dst);
|
||||||
byte[] buf = new byte[32*1024];
|
|
||||||
int len;
|
int len;
|
||||||
while ((len = in.read(buf)) > 0) {
|
while ((len = in.read(copyBuffer)) > 0) {
|
||||||
out.write(buf, 0, len);
|
out.write(copyBuffer, 0, len);
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
out.close();
|
out.close();
|
||||||
|
|
Loading…
Reference in New Issue