| Package | Description |
|---|---|
| com.peterphi.std.types |
| Modifier and Type | Field and Description |
|---|---|
static StorageUnit[] |
StorageUnit.BINARY_QUANTIFIERS
The range of quantifiers for binary units (bytes to terabytes (ISO: B to TiB))
|
static StorageUnit[] |
StorageUnit.COMPSCI_BINARY |
static StorageUnit[] |
StorageUnit.DECIMAL_QUANTIFIERS
The range of quantifiers for ISO decimal units (bytes to terabytes (ISO: B to TB))
|
static StorageUnit[] |
StorageUnit.NETWORK_DECIMAL |
static StorageUnit[] |
StorageUnit.STORAGE_DECIMAL |
| Modifier and Type | Method and Description |
|---|---|
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)
|
StorageUnit |
StorageSize.getUnit()
The unit which this Storage Size should be expressed by default
|
static StorageUnit |
StorageUnit.largest(StorageUnit unit,
StorageUnit unit2)
Returns the the larger unit of
unit and unit2 |
static StorageUnit |
StorageUnit.parse(String original)
Parse the non-ISO abbreviation: MiB and MB both -> MEGABYTE (which is technically a "Mebibyte")
|
static StorageUnit |
StorageUnit.parseISO(String toParse)
Parse the ISO abbreviation: (e.g.
|
static StorageUnit |
StorageUnit.smallest(StorageUnit unit,
StorageUnit unit2)
Returns the the most diminutive unit of
unit and unit2 |
static StorageUnit |
StorageUnit.valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static StorageUnit[] |
StorageUnit.values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
| Modifier and Type | Method and Description |
|---|---|
int |
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 where equals would not return 0 - since this compares based on bits but equals tests based on the
unit+amount |
BigDecimal |
StorageUnit.convert(BigDecimal amount,
StorageUnit unit) |
BigInteger |
StorageUnit.convert(BigInteger amount,
StorageUnit unit) |
long |
StorageUnit.convert(long amount,
StorageUnit unit) |
StorageSize |
StorageSize.convert(StorageUnit toUnit)
Convert this StorageSize to use the named unit
|
BigInteger |
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)
|
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)
|
BigDecimal |
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 of
unit and unit2 |
static StorageUnit |
StorageUnit.smallest(StorageUnit unit,
StorageUnit unit2)
Returns the the most diminutive unit of
unit and unit2 |
String |
StorageSize.toPlainString(StorageUnit unit)
Return a String version of this size (e.g.
|
String |
StorageSize.toShortString(StorageUnit unit)
Return a short ISO String version of this size using the provided unit (e.g.
|
| Constructor and Description |
|---|
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. |
StorageSize(long amount,
StorageUnit unit) |
StorageSize(StorageUnit unit,
BigInteger bits)
Internal constructor.
|
Copyright © 2016. All rights reserved.