public class DataUnitFormatter extends Object implements Serializable
Constructor and Description |
---|
DataUnitFormatter()
Creates a new DataUnit formatter with default system locale,
without decimals.
|
DataUnitFormatter(int decimalPrecision)
Creates a new DataUnit formatter with default system locale
with the maximum number of decimals returned when applicable.
|
DataUnitFormatter(Locale locale)
Creates a new DataUnit formatter without decimals.
|
DataUnitFormatter(Locale locale,
int decimalPrecision)
Creates a new DataUnit formatter with the maximum number of decimals
returned when applicable.
|
DataUnitFormatter(Locale locale,
int decimalPrecision,
boolean fixedUnit)
Creates a new DataUnit formatter with the maximum number of decimals
returned when applicable.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
format(long amount,
DataUnit unit)
Formats a data amount of the given unit to a human-readable
representation.
|
int |
hashCode() |
String |
toString() |
public DataUnitFormatter()
public DataUnitFormatter(Locale locale)
locale
- a localepublic DataUnitFormatter(int decimalPrecision)
decimalPrecision
- number of decimalspublic DataUnitFormatter(Locale locale, int decimalPrecision)
locale
- a localedecimalPrecision
- number of decimalspublic DataUnitFormatter(Locale locale, int decimalPrecision, boolean fixedUnit)
fixedUnit
to true
to ensure
the data units supplied are not change in the formatting.locale
- a localedecimalPrecision
- number of decimalsfixedUnit
- true
to keep original unit in formattingCopyright © 2008–2021 Norconex Inc.. All rights reserved.