Uses of Enum Class
com.peterphi.std.types.StorageUnit
Packages that use StorageUnit
-
Uses of StorageUnit in com.peterphi.std.types
Fields in com.peterphi.std.types declared as StorageUnitModifier and TypeFieldDescriptionstatic final StorageUnit[]
StorageUnit.BINARY_QUANTIFIERS
The range of quantifiers for binary units (bytes to terabytes (ISO: B to TiB))static final StorageUnit[]
StorageUnit.COMPSCI_BINARY
static final StorageUnit[]
StorageUnit.DECIMAL_QUANTIFIERS
The range of quantifiers for ISO decimal units (bytes to terabytes (ISO: B to TB))static final StorageUnit[]
StorageUnit.NETWORK_DECIMAL
static final StorageUnit[]
StorageUnit.STORAGE_DECIMAL
Methods in com.peterphi.std.types that return StorageUnitModifier and TypeMethodDescriptionstatic StorageUnit
StorageUnit.getAppropriateBinaryUnit
(BigInteger amount, StorageUnit sourceUnit) Attempts to locate the most appropriate binary unit (binary units are what everyone but the ISO and the storage industry mean by "KB", "MB", etc.static StorageUnit
StorageUnit.getAppropriateDecimalUnit
(BigInteger amount, StorageUnit sourceUnit) Attempts to locate the most appropriate decimal unit (decimal units are what the ISO and the storage industry (but nobody else) mean by "KB", "MB", etc.static StorageUnit
StorageUnit.getAppropriateUnit
(BigInteger amount, StorageUnit sourceUnit, StorageUnit[] options) Attempts to locate the most appropriate of the provided units to express the provided amount in for human use (balancing precision and sensible expression)StorageSize.getUnit()
The unit which this Storage Size should be expressed by defaultstatic StorageUnit
StorageUnit.largest
(StorageUnit unit, StorageUnit unit2) Returns the the larger unit ofunit
and unit2static StorageUnit
Parse the non-ISO abbreviation: MiB and MB both -> MEGABYTE (which is technically a "Mebibyte")static StorageUnit
Parse the ISO abbreviation: (e.g.static StorageUnit
StorageUnit.smallest
(StorageUnit unit, StorageUnit unit2) Returns the the most diminutive unit ofunit
and unit2static StorageUnit
Returns the enum constant of this class with the specified name.static StorageUnit[]
StorageUnit.values()
Returns an array containing the constants of this enum class, in the order they are declared.Methods in com.peterphi.std.types with parameters of type StorageUnitModifier and TypeMethodDescriptionint
StorageSize.compareTo
(long amount, StorageUnit unit) Performs a comparison based on the number of bits represented
Since this class has a natural ordering that is inconsistent with equals, this method may return 0 whereequals
would not return0
- since this compares based on bits but equals tests based on the unit+amountStorageSize.convert
(StorageUnit toUnit) Convert this StorageSize to use the named unitlong
StorageUnit.convert
(long amount, StorageUnit unit) StorageUnit.convert
(BigDecimal amount, StorageUnit unit) StorageUnit.convert
(BigInteger amount, StorageUnit unit) StorageSize.getAmount
(StorageUnit unit) Converts the size of this StorageSize to another unit, rounding the result to an integer
This method may result in the loss of information (due to rounding).static StorageUnit
StorageUnit.getAppropriateBinaryUnit
(BigInteger amount, StorageUnit sourceUnit) Attempts to locate the most appropriate binary unit (binary units are what everyone but the ISO and the storage industry mean by "KB", "MB", etc.static StorageUnit
StorageUnit.getAppropriateDecimalUnit
(BigInteger amount, StorageUnit sourceUnit) Attempts to locate the most appropriate decimal unit (decimal units are what the ISO and the storage industry (but nobody else) mean by "KB", "MB", etc.static StorageUnit
StorageUnit.getAppropriateUnit
(BigInteger amount, StorageUnit sourceUnit, StorageUnit[] options) Attempts to locate the most appropriate of the provided units to express the provided amount in for human use (balancing precision and sensible expression)StorageSize.getDecimalAmount
(StorageUnit unit) Converts the size of this StorageSize to another unit, returning the result as a real number (using the BigDecimal type)
The calculations may result in minimal loss of precision, however this is unavoidable.static StorageUnit
StorageUnit.largest
(StorageUnit unit, StorageUnit unit2) Returns the the larger unit ofunit
and unit2static StorageUnit
StorageUnit.smallest
(StorageUnit unit, StorageUnit unit2) Returns the the most diminutive unit ofunit
and unit2StorageSize.toPlainString
(StorageUnit unit) Return a String version of this size (e.g.StorageSize.toShortString
(StorageUnit unit) Return a short ISO String version of this size using the provided unit (e.g.Constructors in com.peterphi.std.types with parameters of type StorageUnitModifierConstructorDescriptionStorageSize
(long amount, StorageUnit unit) protected
StorageSize
(StorageUnit unit, BigInteger bits) Internal constructor.StorageSize
(BigDecimal amount, StorageUnit unit) Creates a new StorageSize where the value is an approximation of the provided value
Since this is an approximation some information may be lost.StorageSize
(BigInteger amount, StorageUnit unit) Creates a new StorageSize where the value is equal to the provided value
If the unit is in BITS then any fractional bytes resulting from the conversion will be discarded (e.g.