Enum Class MemoryUnit

java.lang.Object
java.lang.Enum<MemoryUnit>
org.openspaces.core.util.MemoryUnit
All Implemented Interfaces:
Serializable, Comparable<MemoryUnit>, java.lang.constant.Constable

public enum MemoryUnit extends Enum<MemoryUnit>
  • Enum Constant Details

    • BYTES

      public static final MemoryUnit BYTES
    • KILOBYTES

      public static final MemoryUnit KILOBYTES
    • MEGABYTES

      public static final MemoryUnit MEGABYTES
    • GIGABYTES

      public static final MemoryUnit GIGABYTES
    • TERABYTES

      public static final MemoryUnit TERABYTES
    • PETABYTES

      public static final MemoryUnit PETABYTES
    • EXABYTES

      public static final MemoryUnit EXABYTES
  • Method Details

    • values

      public static MemoryUnit[] 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

      public static MemoryUnit valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • convert

      public long convert(long memory, MemoryUnit unit)
      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 unit
      unit - 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

      public static long toBytes(String memory)
    • convert

      public long convert(String memoryCapacity)
    • 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

      public static long toKiloBytes(String memory)
    • 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

      public static long toMegaBytes(String memory)
    • 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

      public static long toGigaBytes(String memory)
    • 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

      public static long toTeraBytes(String memory)
    • 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

      public static long toPetaBytes(String memory)
    • 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

      public static long toExaBytes(String memory)
    • toPostfix

      public String toPostfix()
    • getPostfix

      public String getPostfix()