commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jean-Noel Rouvignac (Created) (JIRA)" <>
Subject [jira] [Created] (IO-294) Adding FileUtils.byteCountToDisplaySize(long size, boolean useSiUnits)
Date Mon, 12 Dec 2011 19:05:31 GMT
Adding FileUtils.byteCountToDisplaySize(long size, boolean useSiUnits)

                 Key: IO-294
             Project: Commons IO
          Issue Type: New Feature
          Components: Utilities
    Affects Versions: 2.1
            Reporter: Jean-Noel Rouvignac
             Fix For: 2.2

I have written a little Utility method that might benefit Commons IO:

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
     * </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) {

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message