public class ByteFormat
extends java.text.Format
Constructor and Description |
---|
ByteFormat() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format(long bytes)
Formats a long which represent a number of bytes.
|
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer buf,
java.text.FieldPosition pos)
Format the given object (must be a Long).
|
java.lang.String |
formatKB(long kilobytes)
Formats a long which represent a number of kilobytes.
|
java.lang.Object |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
In this implementation, returns null always.
|
public java.lang.String format(long bytes)
public java.lang.String formatKB(long kilobytes)
kilobytes
- Long kbytes to format as a string.public java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer buf, java.text.FieldPosition pos)
format
in class java.text.Format
obj
- assumed to be the number of bytes as a Long.buf
- the StringBuffer to append to.pos
- field position.public java.lang.Object parseObject(java.lang.String source, java.text.ParsePosition pos)
parseObject
in class java.text.Format
source
- Source string to parse.pos
- Position to parse from.