public enum SizeUnit extends Enum<SizeUnit>
| Enum Constant and Description |
|---|
BYTES
Bytes.
|
GIGABYTES
Gigabytes.
|
KILOBYTES
Kilobytes.
|
MEGABYTES
Megabytes.
|
PETABYTES
Petabytes.
|
TERABYTES
Terabytes.
|
| Modifier and Type | Method and Description |
|---|---|
long |
convert(long size,
SizeUnit unit)
Converts a size of the given unit into the current unit.
|
long |
toBytes(long l)
Converts the given number of the current units into bytes.
|
long |
toGigabytes(long l)
Converts the given number of the current units into gigabytes.
|
long |
toKilobytes(long l)
Converts the given number of the current units into kilobytes.
|
long |
toMegabytes(long l)
Converts the given number of the current units into megabytes.
|
long |
toPetabytes(long l)
Converts the given number of the current units into petabytes.
|
long |
toTerabytes(long l)
Converts the given number of the current units into terabytes.
|
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 final SizeUnit PETABYTES
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 long convert(long size,
SizeUnit unit)
size - the magnitude of the sizeunit - the unit of the sizepublic long toBytes(long l)
l - the magnitude of the size in the current unitl of the current units in bytespublic long toKilobytes(long l)
l - the magnitude of the size in the current unitl of the current units in kilobytespublic long toMegabytes(long l)
l - the magnitude of the size in the current unitl of the current units in megabytespublic long toGigabytes(long l)
l - the magnitude of the size in the current unitl of the current units in bytespublic long toTerabytes(long l)
l - the magnitude of the size in the current unitl of the current units in terabytespublic long toPetabytes(long l)
l - the magnitude of the size in the current unitl of the current units in terabytesCopyright © 2022. All rights reserved.