Package org.openspaces.core.util
Enum Class MemoryUnit
- All Implemented Interfaces:
Serializable,Comparable<MemoryUnit>,java.lang.constant.Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionlongconvert(long memory, MemoryUnit unit) Convert the given memory capacity in the given unit to this unit.longlongtoBytes(long memory) Equivalent to BYTES.convert(memory, this).static longlongtoExaBytes(long memory) Equivalent to EXABYTES.convert(memory, this).static longtoExaBytes(String memory) longtoGigaBytes(long memory) Equivalent to GIGABYTES.convert(memory, this).static longtoGigaBytes(String memory) longtoKiloBytes(long memory) Equivalent to KILOBYTES.convert(memory, this).static longtoKiloBytes(String memory) longtoMegaBytes(long memory) Equivalent to MEGABYTES.convert(memory, this).static longtoMegaBytes(String memory) longtoPetaBytes(long memory) Equivalent to PETABYTES.convert(memory, this).static longtoPetaBytes(String memory) longtoTeraBytes(long memory) Equivalent to TERABYTES.convert(memory, this).static longtoTeraBytes(String memory) static MemoryUnitReturns the enum constant of this class with the specified name.static MemoryUnit[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
BYTES
-
KILOBYTES
-
MEGABYTES
-
GIGABYTES
-
TERABYTES
-
PETABYTES
-
EXABYTES
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
convert
Convert the given memory capacity in the given unit to this unit. Conversions from finer to coarser granularities truncate, so lose precision. For example converting 1023 bytes to kilobytes results in 0. Conversions from coarser to finer granularities with arguments that would numerically overflow saturate to Long.MIN_VALUE if negative or Long.MAX_VALUE if positive.- Parameters:
memory- capacity in the given unitunit- the unit of the memory argument- Returns:
- the converted memory in this unit, or Long.MIN_VALUE if conversion would negatively overflow, or Long.MAX_VALUE if it would positively overflow.
-
toBytes
public long toBytes(long memory) Equivalent to BYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Bytes- Returns:
- the converted memory, or Long.MIN_VALUE if conversion would negatively overflow, or Long.MAX_VALUE if it would positively overflow.
- See Also:
-
toBytes
-
convert
-
toKiloBytes
public long toKiloBytes(long memory) Equivalent to KILOBYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Kilo Bytes- Returns:
- the converted memory, or Long.MIN_VALUE if conversion would negatively overflow, or Long.MAX_VALUE if it would positively overflow.
- See Also:
-
toKiloBytes
-
toMegaBytes
public long toMegaBytes(long memory) Equivalent to MEGABYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Mega Bytes- Returns:
- the converted memory, or Long.MIN_VALUE if conversion would negatively overflow, or Long.MAX_VALUE if it would positively overflow.
- See Also:
-
toMegaBytes
-
toGigaBytes
public long toGigaBytes(long memory) Equivalent to GIGABYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Giga Bytes- Returns:
- the converted memory.
- See Also:
-
toGigaBytes
-
toTeraBytes
public long toTeraBytes(long memory) Equivalent to TERABYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Tera Bytes- Returns:
- the converted memory.
- See Also:
-
toTeraBytes
-
toPetaBytes
public long toPetaBytes(long memory) Equivalent to PETABYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Peta Bytes- Returns:
- the converted memory.
- See Also:
-
toPetaBytes
-
toExaBytes
public long toExaBytes(long memory) Equivalent to EXABYTES.convert(memory, this).- Parameters:
memory- the memory to convert to Exa Bytes- Returns:
- the converted memory.
- See Also:
-
toExaBytes
-
toPostfix
-
getPostfix
-