Return-Path: Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: (qmail 70838 invoked from network); 18 Sep 2010 13:03:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 Sep 2010 13:03:48 -0000 Received: (qmail 64957 invoked by uid 500); 18 Sep 2010 13:03:48 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 64816 invoked by uid 500); 18 Sep 2010 13:03:46 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 64807 invoked by uid 99); 18 Sep 2010 13:03:45 -0000 Received: from Unknown (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Sep 2010 13:03:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 18 Sep 2010 13:03:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C426C23889B9; Sat, 18 Sep 2010 13:03:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r998464 - /cassandra/trunk/src/java/org/apache/cassandra/io/util/FileUtils.java Date: Sat, 18 Sep 2010 13:03:06 -0000 To: commits@cassandra.apache.org From: jbellis@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100918130306.C426C23889B9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jbellis Date: Sat Sep 18 13:03:06 2010 New Revision: 998464 URL: http://svn.apache.org/viewvc?rev=998464&view=rev Log: r/m unused methods in FileUtils. patch by jbellis Modified: cassandra/trunk/src/java/org/apache/cassandra/io/util/FileUtils.java Modified: cassandra/trunk/src/java/org/apache/cassandra/io/util/FileUtils.java URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/io/util/FileUtils.java?rev=998464&r1=998463&r2=998464&view=diff ============================================================================== --- cassandra/trunk/src/java/org/apache/cassandra/io/util/FileUtils.java (original) +++ cassandra/trunk/src/java/org/apache/cassandra/io/util/FileUtils.java Sat Sep 18 13:03:06 2010 @@ -83,19 +83,6 @@ public class FileUtils } } - public static void createFile(String directory) throws IOException - { - File file = new File(directory); - if ( !file.exists() ) - file.createNewFile(); - } - - public static boolean isExists(String filename) throws IOException - { - File file = new File(filename); - return file.exists(); - } - public static boolean delete(String file) { File f = new File(file); @@ -119,17 +106,9 @@ public class FileUtils return bVal; } - public static void delete(File[] files) throws IOException - { - for ( File file : files ) - { - file.delete(); - } - } - public static String stringifyFileSize(double value) { - double d = 0d; + double d; if ( value >= tb_ ) { d = value / tb_; @@ -160,29 +139,6 @@ public class FileUtils return val + " bytes"; } } - - /** - * calculate the total space used by a file or directory - * - * @param path the path - * @return total space used. - */ - public static long getUsedDiskSpaceForPath(String path) - { - File file = new File(path); - - if (file.isFile()) - { - return file.length(); - } - - long diskSpace = 0; - for (File childFile: file.listFiles()) - { - diskSpace += getUsedDiskSpaceForPath(childFile.getPath()); - } - return diskSpace; - } /** * Deletes all files and subdirectories under "dir". @@ -194,9 +150,9 @@ public class FileUtils if (dir.isDirectory()) { String[] children = dir.list(); - for (int i = 0; i < children.length; i++) + for (String child : children) { - deleteRecursive(new File(dir, children[i])); + deleteRecursive(new File(dir, child)); } }