commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r1201022 - in /commons/proper/io/trunk/src: main/java/org/apache/commons/io/FileUtils.java test/java/org/apache/commons/io/FileUtilsTestCase.java
Date Fri, 11 Nov 2011 18:45:53 GMT
Author: bayard
Date: Fri Nov 11 18:45:53 2011
New Revision: 1201022

URL: http://svn.apache.org/viewvc?rev=1201022&view=rev
Log:
Adding EB/PB/TB per IO-287 and Ron Kuris' patch

Modified:
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
    commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java?rev=1201022&r1=1201021&r2=1201022&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/FileUtils.java Fri Nov 11
18:45:53 2011
@@ -352,14 +352,13 @@ public class FileUtils {
     public static String byteCountToDisplaySize(long size) {
         String displaySize;
 
-//        if (size / ONE_EB > 0) {
-//            displaySize = String.valueOf(size / ONE_EB) + " EB";
-//        } else if (size / ONE_PB > 0) {
-//            displaySize = String.valueOf(size / ONE_PB) + " PB";
-//        } else if (size / ONE_TB > 0) {
-//            displaySize = String.valueOf(size / ONE_TB) + " TB";
-//        } else 
-        if (size / ONE_GB > 0) {
+        if (size / ONE_EB > 0) {
+            displaySize = String.valueOf(size / ONE_EB) + " EB";
+        } else if (size / ONE_PB > 0) {
+            displaySize = String.valueOf(size / ONE_PB) + " PB";
+        } else if (size / ONE_TB > 0) {
+            displaySize = String.valueOf(size / ONE_TB) + " TB";
+        } else if (size / ONE_GB > 0) {
             displaySize = String.valueOf(size / ONE_GB) + " GB";
         } else if (size / ONE_MB > 0) {
             displaySize = String.valueOf(size / ONE_MB) + " MB";

Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java?rev=1201022&r1=1201021&r2=1201022&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/FileUtilsTestCase.java Fri
Nov 11 18:45:53 2011
@@ -324,10 +324,10 @@ public class FileUtilsTestCase extends F
         assertEquals(FileUtils.byteCountToDisplaySize(1024 * 1024 * 1024), "1 GB");
         assertEquals(FileUtils.byteCountToDisplaySize(1024 * 1024 * 1025), "1 GB");
         assertEquals(FileUtils.byteCountToDisplaySize((1024 * 1024 * 1024 * 2) - 1), "1 GB");
-//        assertEquals(FileUtils.byteCountToDisplaySize(1024L * 1024 * 1024 * 1024), "1 TB");
-//        assertEquals(FileUtils.byteCountToDisplaySize(1024L * 1024 * 1024 * 1024 * 1024),
"1 PB");
-//        assertEquals(FileUtils.byteCountToDisplaySize(1024L * 1024 * 1024 * 1024 * 1024
* 1024), "1 EB");
-//        assertEquals(FileUtils.byteCountToDisplaySize(Long.MAX_VALUE), "7 EB");
+        assertEquals(FileUtils.byteCountToDisplaySize(1024L * 1024 * 1024 * 1024), "1 TB");
+        assertEquals(FileUtils.byteCountToDisplaySize(1024L * 1024 * 1024 * 1024 * 1024),
"1 PB");
+        assertEquals(FileUtils.byteCountToDisplaySize(1024L * 1024 * 1024 * 1024 * 1024 *
1024), "1 EB");
+        assertEquals(FileUtils.byteCountToDisplaySize(Long.MAX_VALUE), "7 EB");
         // Other MAX_VALUEs
         assertEquals(FileUtils.byteCountToDisplaySize(Character.MAX_VALUE), "63 KB");
         assertEquals(FileUtils.byteCountToDisplaySize(Short.MAX_VALUE), "31 KB");



Mime
View raw message