From 0564c883bef439af993a7a9f0163b4ccee0d7491 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Wed, 9 Apr 2014 16:15:15 +0200 Subject: [PATCH] Remove unused FileSystemUtils#copyFile --- .../common/io/FileSystemUtils.java | 33 +------------------ 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java b/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java index bf3291e03ec6f..384ca07aa6c1a 100644 --- a/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java +++ b/src/main/java/org/elasticsearch/common/io/FileSystemUtils.java @@ -80,11 +80,7 @@ public static int maxOpenFiles(File testDir) { } catch (IOException ioe) { int i = 0; for (RandomAccessFile raf : files) { - try { - raf.close(); - } catch (IOException e) { - // ignore - } + IOUtils.closeWhileHandlingException(raf); new File(testDir, "tmp" + i++).delete(); } if (dirCreated) { @@ -229,33 +225,6 @@ public static void syncFile(File fileToSync, boolean isDir) throws IOException { throw exc; } - public static void copyFile(File sourceFile, File destinationFile) throws IOException { - FileInputStream sourceIs = null; - FileChannel source = null; - FileOutputStream destinationOs = null; - FileChannel destination = null; - try { - sourceIs = new FileInputStream(sourceFile); - source = sourceIs.getChannel(); - destinationOs = new FileOutputStream(destinationFile); - destination = destinationOs.getChannel(); - destination.transferFrom(source, 0, source.size()); - } finally { - if (source != null) { - source.close(); - } - if (sourceIs != null) { - sourceIs.close(); - } - if (destination != null) { - destination.close(); - } - if (destinationOs != null) { - destinationOs.close(); - } - } - } - /** * Check that a directory exists, is a directory and is readable * by the current user