public enum ByteUnit extends Enum<ByteUnit>
Can be used to convert between units as well, see convert(double, ByteUnit).
| Modifier and Type | Class and Description |
|---|---|
static interface |
ByteUnit.Conversion
Fluent API helper for
convert(double, ByteUnit) to get readable code like: |
| Enum Constant and Description |
|---|
B |
EB |
EiB |
GB |
GiB |
KB |
KiB |
MB |
MiB |
PB |
PiB |
TB |
TiB |
YB |
YiB |
ZB |
ZiB |
| Modifier and Type | Method and Description |
|---|---|
static ByteUnit.Conversion |
convert(double sourceValue,
ByteUnit sourceUnit)
Starts a conversion, continue with
ByteUnit.Conversion.to(ByteUnit), e.g.: |
static ByteUnit |
ofName(String name) |
long |
toBytes(double value)
Returns the number of bytes, which this unit multiplied by
value yields. |
static ByteUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ByteUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ByteUnit B
public static final ByteUnit KB
public static final ByteUnit MB
public static final ByteUnit GB
public static final ByteUnit TB
public static final ByteUnit PB
public static final ByteUnit EB
public static final ByteUnit ZB
public static final ByteUnit YB
public static final ByteUnit KiB
public static final ByteUnit MiB
public static final ByteUnit GiB
public static final ByteUnit TiB
public static final ByteUnit PiB
public static final ByteUnit EiB
public static final ByteUnit ZiB
public static final ByteUnit YiB
public static ByteUnit[] values()
for (ByteUnit c : ByteUnit.values()) System.out.println(c);
public static ByteUnit 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 ByteUnit.Conversion convert(double sourceValue, ByteUnit sourceUnit)
ByteUnit.Conversion.to(ByteUnit), e.g.:
convert(1.5, ByteMultiple.MB).to(ByteMultiple.KB);
sourceValue - the source value to convertsourceUnit - the source unit to convertByteUnit.Conversionpublic long toBytes(double value)
value yields.value - the value to convertCopyright © 2022 MicroStream Software. All rights reserved.