ch.randelshofer.util
Class FileSizeFormat
java.lang.Object
ch.randelshofer.util.FileSizeFormat
public class FileSizeFormat
- extends java.lang.Object
Formats units in bytes into a human readable string.
FIXME - Rework this, so that we can specify the number of desired digits.
- Version:
- 1.1.1 2010-06-20 Don't scale byte values to kilobytes.
1.1 2009-07-05 By default use megabyte units instead of mebibyte units.
1.0 2009-03-20 Created.
- Author:
- Werner Randelshofer
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FileSizeFormat
public FileSizeFormat()
setMaximumFractionDigits
public void setMaximumFractionDigits(int newValue)
setAlwaysIncludeBytes
public void setAlwaysIncludeBytes(boolean newValue)
setShortFormat
public void setShortFormat(boolean newValue)
setMebibyte
public void setMebibyte(boolean isMebibyte)
isMebibyte
public boolean isMebibyte()
format
public java.lang.String format(long w)
- Returns a medium version of the formatted string.
- Parameters:
w - Units in bytes.
- Returns:
- Formatted string.
getInstance
public static FileSizeFormat getInstance()