commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Noel Rouvignac (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=13167711#comment-13167711
] 

Jean-Noel Rouvignac commented on IO-294:
----------------------------------------

Also, FileUtils.byteCountToDisplaySize(long size) could also be changed to use this new method
if you are not too worried about the compatibility of its output compared to previous versions.
                
> 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