Enum Constant and Description |
---|
Bytes
Bytes.
|
GB
Gigabytes.
|
KB
Kilobytes.
|
MB
Megabytes.
|
PB
Petabytes.
|
TB
Terabytes.
|
Modifier and Type | Method and Description |
---|---|
long |
convert(long value,
SpaceUnit unit)
For example, to convert 2048 bytes to KB, use: SpaceUnit.KB.convert(2048L,
SpaceUnit.Bytes).
|
double |
convertDecimal(double value,
SpaceUnit unit)
For example, to convert 2048 bytes to KB, use: SpaceUnit.KB.convert(2048L,
SpaceUnit.Bytes).
|
static SpaceUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static SpaceUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SpaceUnit Bytes
public static final SpaceUnit KB
public static final SpaceUnit MB
public static final SpaceUnit GB
public static final SpaceUnit TB
public static final SpaceUnit PB
public static SpaceUnit[] values()
for (SpaceUnit c : SpaceUnit.values()) System.out.println(c);
public static SpaceUnit valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic long convert(long value, SpaceUnit unit)
value
- space amountunit
- space unitpublic double convertDecimal(double value, SpaceUnit unit)
value
- space amountunit
- space unit