Package org.jivesoftware.util
Class ByteFormat
- java.lang.Object
-
- java.text.Format
-
- org.jivesoftware.util.ByteFormat
-
- All Implemented Interfaces:
Serializable,Cloneable
public class ByteFormat extends Format
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:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
-
Constructor Summary
Constructors Constructor Description ByteFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringformat(long bytes)Formats a long which represent a number of bytes.StringBufferformat(Object obj, StringBuffer buf, FieldPosition pos)Format the given object (must be a Long).StringformatKB(long kilobytes)Formats a long which represent a number of kilobytes.ObjectparseObject(String source, ParsePosition pos)In this implementation, returns null always.-
Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
-
-
-
Method Detail
-
format
public String format(long bytes)
Formats a long which represent a number of bytes.- Parameters:
bytes- the number of bytes to format- Returns:
- the formatted string
-
formatKB
public String formatKB(long kilobytes)
Formats a long which represent a number of kilobytes.- Parameters:
kilobytes- the number of kilobytes to format- Returns:
- the formatted string
-
format
public StringBuffer format(Object obj, StringBuffer buf, FieldPosition pos)
Format the given object (must be a Long).
-
parseObject
public Object parseObject(String source, ParsePosition pos)
In this implementation, returns null always.- Specified by:
parseObjectin classFormat- Parameters:
source- unused parameterpos- unused parameter- Returns:
- returns null in this implementation.
-
-