public enum DecimalSizeUnit extends java.lang.Enum<DecimalSizeUnit>
Enum Constant and Description |
---|
BYTES
The size unit that represents bytes.
|
EXABYTES
The size unit that represents exabytes.
|
GIGABYTES
The size unit that represents gigabytes.
|
KILOBYTES
The size unit that represents kilobytes.
|
MEGABYTES
The size unit that represents megabytes.
|
PETABYTES
The size unit that represents petabyte.
|
TERABYTES
The size unit that represents terabytes.
|
YOTTABYTES
The size unit that represents yottabytes.
|
ZETTABYTES
The size unit that represents zettabytes.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bytesToHumanReadableSize(java.math.BigInteger numBytes)
Retrieves a string that represents a human-readable representation of the
specified number of bytes.
|
static java.lang.String |
bytesToHumanReadableSize(long numBytes)
Retrieves a string that represents a human-readable representation of the
specified number of bytes.
|
static DecimalSizeUnit |
forName(java.lang.String name)
Retrieves the decimal size unit value that has the given name as either its
singular name, plural name, or abbreviation, in a case-insensitive manner.
|
java.math.BigDecimal |
fromBytes(java.math.BigInteger numBytes)
Retrieves the number of instances of this unit represented by the
specified number of bytes.
|
java.math.BigDecimal |
fromBytes(long numBytes)
Retrieves the number of instances of this unit represented by the
specified number of bytes.
|
java.lang.String |
getAbbreviation()
Retrieves the abbreviation for this size unit.
|
java.math.BigInteger |
getNumBytesPerUnit()
Retrieves the number of bytes per single instance of this size unit.
|
java.lang.String |
getPluralName()
Retrieves the plural name for this size unit.
|
java.lang.String |
getSingularName()
Retrieves the singular name for this size unit.
|
java.math.BigInteger |
toBytes(java.math.BigDecimal value)
Retrieves the number of bytes in the specified number of instances of this
size unit, rounded to the nearest integer.
|
java.math.BigInteger |
toBytes(java.math.BigInteger value)
Retrieves the number of bytes in the specified number of instances of this
size unit.
|
java.math.BigInteger |
toBytes(double value)
Retrieves the number of bytes in the specified number of instances of this
size unit, rounded to the nearest integer.
|
java.math.BigInteger |
toBytes(long value)
Retrieves the number of bytes in the specified number of instances of this
size unit.
|
static DecimalSizeUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static DecimalSizeUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DecimalSizeUnit BYTES
public static final DecimalSizeUnit KILOBYTES
public static final DecimalSizeUnit MEGABYTES
public static final DecimalSizeUnit GIGABYTES
public static final DecimalSizeUnit TERABYTES
public static final DecimalSizeUnit PETABYTES
public static final DecimalSizeUnit EXABYTES
public static final DecimalSizeUnit ZETTABYTES
public static final DecimalSizeUnit YOTTABYTES
public static DecimalSizeUnit[] values()
for (DecimalSizeUnit c : DecimalSizeUnit.values()) System.out.println(c);
public static DecimalSizeUnit 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 null@NotNull public java.math.BigInteger getNumBytesPerUnit()
@NotNull public java.lang.String getSingularName()
@NotNull public java.lang.String getPluralName()
@NotNull public java.lang.String getAbbreviation()
@NotNull public java.math.BigInteger toBytes(long value)
value
- The number of instances of this unit to convert to bytes.@NotNull public java.math.BigInteger toBytes(@NotNull java.math.BigInteger value)
value
- The number of instances of this unit to convert to bytes.
It must not be null
.@NotNull public java.math.BigInteger toBytes(double value)
value
- The number of instances of this unit to convert to bytes.@NotNull public java.math.BigInteger toBytes(@NotNull java.math.BigDecimal value)
value
- The number of instances of this unit to convert to bytes.
It must not be null
.@NotNull public java.math.BigDecimal fromBytes(long numBytes)
numBytes
- The number of bytes to use to make the determination.@NotNull public java.math.BigDecimal fromBytes(@NotNull java.math.BigInteger numBytes)
numBytes
- The number of bytes to use to make the determination. It
must not be null
.@NotNull public static java.lang.String bytesToHumanReadableSize(long numBytes)
numBytes
- The number of bytes to represent as a human-readable
size. It must be greater than or equal to zero.@NotNull public static java.lang.String bytesToHumanReadableSize(@NotNull java.math.BigInteger numBytes)
numBytes
- The number of bytes to represent as a human-readable
size. It must not be null
, and it must represent
a value that is greater than or equal to zero.@Nullable public static DecimalSizeUnit forName(@NotNull java.lang.String name)
name
- The name for which to retrieve the decimal size unit value.
It must not be null
.null
if
no value has a singular name, plural name, or abbreviation that
matches the provided name in a case-insensitive manner.