public enum SizeUnit extends Enum<SizeUnit>
Enum Constant and Description |
---|
BYTES |
GIGABYTES |
KILOBYTES |
MEGABYTES |
TERABYTES |
Modifier and Type | Method and Description |
---|---|
String |
getAbbreviation() |
static Pair<Double,SizeUnit> |
getHumanReadableSize(double size,
SizeUnit unit) |
int |
getOrdinal() |
static long |
parseBytes(String input)
Parses a string that represents a size into the number of bytes represented by that string.
|
long |
toBytes(double size) |
long |
toGigabytes(double size) |
static String |
toHumanReadableString(Pair<Double,SizeUnit> size,
Locale locale) |
long |
toKilobytes(double size) |
long |
toMegabytes(double size) |
long |
toTerabytes(double 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.
|
public static final SizeUnit BYTES
public static final SizeUnit KILOBYTES
public static final SizeUnit MEGABYTES
public static final SizeUnit GIGABYTES
public static final SizeUnit TERABYTES
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 nameNullPointerException
- if the argument is nullpublic int getOrdinal()
public String getAbbreviation()
public static long parseBytes(String input) throws NumberFormatException
NumberFormatException
public long toBytes(double size)
public long toKilobytes(double size)
public long toMegabytes(double size)
public long toGigabytes(double size)
public long toTerabytes(double size)
public static Pair<Double,SizeUnit> getHumanReadableSize(double size, SizeUnit unit)