public static enum Unit.SizeSI extends Enum<Unit.SizeSI>
Enum Constant and Description |
---|
B
bytes.
|
GB
gigabytes.
|
KB
kilobytes.
|
MB
megabytes.
|
TB
terabytes.
|
Modifier and Type | Field and Description |
---|---|
static double |
ZERO_THRESHOLD
Constant used to determine whether we should show "0B".
|
Modifier and Type | Method and Description |
---|---|
static String |
format(double aSize)
Convenience method to directly get a displayable represention of a given
size.
|
String |
format(double aSize,
int aScale)
Returns the given size as string representation using this size unit's
display name.
|
String |
getDisplayName()
Returns the current value of displayName.
|
double |
getFactor()
Returns the current value of factor.
|
static Unit.SizeSI |
toUnit(double aSize)
Returns a
Unit.SizeSI instance usable for representing the given size. |
static Unit.SizeSI |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Unit.SizeSI[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Unit.SizeSI B
public static final Unit.SizeSI KB
public static final Unit.SizeSI MB
public static final Unit.SizeSI GB
public static final Unit.SizeSI TB
public static final double ZERO_THRESHOLD
public static Unit.SizeSI[] values()
for (Unit.SizeSI c : Unit.SizeSI.values()) System.out.println(c);
public static Unit.SizeSI valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static String format(double aSize)
This method does the same as calling:
toUnit( aSize ).format( aSize, 2 );
.
aSize
- the size to get a displayable representation for.null
.public static Unit.SizeSI toUnit(double aSize)
Unit.SizeSI
instance usable for representing the given size.aSize
- the size to convert to a Unit.SizeSI
instance.Unit.SizeSI
instance, never null
.public String format(double aSize, int aScale)
aSize
- the size to convert to a string representation;aScale
- the scale (= number of digits after decimal separator) to use in
the string representation.null
.public String getDisplayName()
public double getFactor()
Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.