Skip to content

Commit

Permalink
Remove unused FileSystemUtils#copyFile
Browse files Browse the repository at this point in the history
  • Loading branch information
s1monw committed Apr 14, 2014
1 parent a215dd3 commit 0564c88
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions src/main/java/org/elasticsearch/common/io/FileSystemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 0564c88

Please sign in to comment.