commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IO-294) Adding FileUtils.byteCountToDisplaySize(long size, boolean useSiUnits)
Date Mon, 12 Dec 2011 19:43:30 GMT

    [ https://issues.apache.org/jira/browse/IO-294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13167709#comment-13167709
] 

Sebb commented on IO-294:
-------------------------

Looks useful; however I'm not sure FileUtils is the correct place for it, as bytes are also
used for network sizes, etc.

The main part of the code purely deals with numbers, and is not specifically related to IO
- perhaps it belongs in Lang?
                
> Adding FileUtils.byteCountToDisplaySize(long size, boolean useSiUnits)
> ----------------------------------------------------------------------
>
>                 Key: IO-294
>                 URL: https://issues.apache.org/jira/browse/IO-294
>             Project: Commons IO
>          Issue Type: New Feature
>          Components: Utilities
>    Affects Versions: 2.1
>            Reporter: Jean-Noel Rouvignac
>             Fix For: 2.2
>
>         Attachments: FileUtils.java, FileUtilsTest.java
>
>
> I have written a little Utility method that might benefit Commons IO:
> {code}
> public class FileUtils {
>     /**
>      * Returns a human-readable version of the file size (original is in bytes). The
implementation has the following features:
>      * <ul>
>      * <li>Supports the SI or IEC units.</li>
>      * <li>Supports I18n</li>
>      * <li>Display a one digit remainder (rounded down if less than 5, rounded
up otherwise)</li>
>      * <li>Once the main unit is >= 100, drops the remainder which would be
over precision.</li>
>      * </ul>
>      * 
>      * @param size The number of bytes.
>      * @param useSiUnits if false, uses the IEC (International Electrotechnical Commission)
units (powers of 2), else uses SI (International System of Units)
>      *            units (powers of 10).
>      * @return A human-readable display value (includes units).
>      */
>     public static String byteCountToDisplaySize(long size, boolean useSiUnits) {
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message