|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<SizeUnit>
nl.lxtreme.ols.api.util.SizeUnit
public enum SizeUnit
Represents a size unit (SI-standard) that has a displayable representation and has a scale factor.
Enum Constant Summary | |
---|---|
B
bytes. |
|
GB
gigabytes. |
|
KB
kilobytes. |
|
MB
megabytes. |
|
TB
terabytes. |
Field Summary | |
---|---|
static double |
ZERO_THRESHOLD
Constant used to determine whether we should show "0B". |
Method Summary | |
---|---|
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 SizeUnit |
toUnit(double aSize)
Returns a SizeUnit instance usable for representing the given size. |
static SizeUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static SizeUnit[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final SizeUnit B
public static final SizeUnit KB
public static final SizeUnit MB
public static final SizeUnit GB
public static final SizeUnit TB
Field Detail |
---|
public static final double ZERO_THRESHOLD
Method Detail |
---|
public static SizeUnit[] values()
for (SizeUnit c : SizeUnit.values()) System.out.println(c);
public static SizeUnit valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- 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 SizeUnit toUnit(double aSize)
SizeUnit
instance usable for representing the given size.
aSize
- the size to convert to a SizeUnit
instance.
SizeUnit
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |