org.apache.pivot.text
Class FileSizeFormat
java.lang.Object
java.text.Format
org.apache.pivot.text.FileSizeFormat
- All Implemented Interfaces:
- Serializable, Cloneable
public class FileSizeFormat
- extends Format
Converts a file size into a human-readable representation using binary
prefixes (1KB = 1024 bytes).
- See Also:
- Serialized Form
KILOBYTE
public static final int KILOBYTE
- See Also:
- Constant Field Values
ABBREVIATIONS
public static final String[] ABBREVIATIONS
format
public StringBuffer format(Object object,
StringBuffer stringBuffer,
FieldPosition fieldPosition)
- Formats a file size.
- Specified by:
format
in class Format
- Parameters:
object
- A Number containing the length of the file, in bytes. May be
negative to indicate an unknown file size.stringBuffer
- The string buffer to which the formatted output will be appended.fieldPosition
- Not used.
- Returns:
- The original string buffer, with the formatted value appended.
parseObject
public Object parseObject(String arg0,
ParsePosition arg1)
- This method is not supported.
- Specified by:
parseObject
in class Format
- Throws:
UnsupportedOperationException
getInstance
public static FileSizeFormat getInstance()
- Returns a shared file size format instance.
- Returns:
- A shared file format size instance.