You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "hellozrh (via GitHub)" <gi...@apache.org> on 2023/11/23 03:24:02 UTC

[PR] add a file size conversion tool. [commons-io]

hellozrh opened a new pull request, #515:
URL: https://github.com/apache/commons-io/pull/515

   File size conversion tool, supporting mutual conversion of TB, GB, MB, KB, Byte, etc.,as well as converting the size of numeric types into human-readable strings. #https://issues.apache.org/jira/browse/IO-822 
   
    The tool can convert any size unit into a human readable version, and support file size unit conversion to and from each other. The implementation method refers to TimeUnit, adopts the feature of enumeration, simplifies the code, and has high efficiency.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "hellozrh (via GitHub)" <gi...@apache.org>.
hellozrh commented on code in PR #515:
URL: https://github.com/apache/commons-io/pull/515#discussion_r1403390765


##########
src/main/java/org/apache/commons/io/FileSizeUnit.java:
##########
@@ -0,0 +1,234 @@
+package org.apache.commons.io;
+
+import java.text.DecimalFormat;
+
+/**
+ * File size conversion tool, supporting mutual conversion of TB, GB, MB, KB, Byte, etc.,
+ * as well as converting the size of numeric types into human-readable strings.
+ * @author hellozrh
+ * @date 2023-11-19
+ */
+public enum FileSizeUnit {
+    /**Byte*/
+    BYTE {
+        @Override
+        public long toByte(long duration) {

Review Comment:
   It should be length



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on code in PR #515:
URL: https://github.com/apache/commons-io/pull/515#discussion_r1403384904


##########
src/main/java/org/apache/commons/io/FileSizeUnit.java:
##########
@@ -0,0 +1,234 @@
+package org.apache.commons.io;
+
+import java.text.DecimalFormat;
+
+/**
+ * File size conversion tool, supporting mutual conversion of TB, GB, MB, KB, Byte, etc.,
+ * as well as converting the size of numeric types into human-readable strings.
+ * @author hellozrh
+ * @date 2023-11-19
+ */
+public enum FileSizeUnit {
+    /**Byte*/
+    BYTE {
+        @Override
+        public long toByte(long duration) {

Review Comment:
   Duration?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "hellozrh (via GitHub)" <gi...@apache.org>.
hellozrh commented on PR #515:
URL: https://github.com/apache/commons-io/pull/515#issuecomment-1824469358

   
   
   
   
   > > Hello @hellozrh Rebase on git master and run `mvn` locally before you push and fix all issues.
   > 
   > I closed the issue as dup.
   
   Discard this submission?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #515:
URL: https://github.com/apache/commons-io/pull/515#issuecomment-1824461068

   > Hello @hellozrh Rebase on git master and run `mvn` locally before you push and fix all issues.
   
   I closed the issue as dup.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #515:
URL: https://github.com/apache/commons-io/pull/515#issuecomment-1824581061

   Closing, let's continue in LANG-1201.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o closed pull request #515: [IO-822] add a file size conversion tool.
URL: https://github.com/apache/commons-io/pull/515


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [IO-822] add a file size conversion tool. [commons-io]

Posted by "michael-o (via GitHub)" <gi...@apache.org>.
michael-o commented on PR #515:
URL: https://github.com/apache/commons-io/pull/515#issuecomment-1824532520

   > > > Hello @hellozrh Rebase on git master and run `mvn` locally before you push and fix all issues.
   > > 
   > > 
   > > I closed the issue as dup.
   > 
   > Discard this submission?
   
   Here yes. It should happen in Lang, but this very change is as bad as the one which was reverted in Lang.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org