Package org.jivesoftware.util
Class ByteFormat
java.lang.Object
java.text.Format
org.jivesoftware.util.ByteFormat
- All Implemented Interfaces:
Serializable
,Cloneable
A formatter for formatting byte sizes. For example, formatting 12345 byes results in
"12.1 K" and 1234567 results in "1.18 MB".
- Author:
- Bill Lynch
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionformat
(long bytes) Formats a long which represent a number of bytes.format
(Object obj, StringBuffer buf, FieldPosition pos) Format the given object (must be a Long).formatKB
(long kilobytes) Formats a long which represent a number of kilobytes.parseObject
(String source, ParsePosition pos) In this implementation, returns null always.Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Constructor Details
-
ByteFormat
public ByteFormat()
-
-
Method Details
-
format
Formats a long which represent a number of bytes.- Parameters:
bytes
- the number of bytes to format- Returns:
- the formatted string
-
formatKB
Formats a long which represent a number of kilobytes.- Parameters:
kilobytes
- the number of kilobytes to format- Returns:
- the formatted string
-
format
Format the given object (must be a Long). -
parseObject
In this implementation, returns null always.- Specified by:
parseObject
in classFormat
- Parameters:
source
- unused parameterpos
- unused parameter- Returns:
- returns null in this implementation.
-