GigaSpaces XAP 9.7.2 API

org.openspaces.core.util
Enum MemoryUnit

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

public enum MemoryUnit
extends Enum<MemoryUnit>


Enum Constant Summary
BYTES
           
EXABYTES
           
GIGABYTES
           
KILOBYTES
           
MEGABYTES
           
PETABYTES
           
TERABYTES
           
 
Method Summary
 long convert(long memory, MemoryUnit unit)
          Convert the given memory capacity in the given unit to this unit.
 long convert(String memoryCapacity)
           
 String getPostfix()
           
 long toBytes(long memory)
          Equivalent to BYTES.convert(memory, this).
static long toBytes(String memory)
           
 long toExaBytes(long memory)
          Equivalent to EXABYTES.convert(memory, this).
static long toExaBytes(String memory)
           
 long toGigaBytes(long memory)
          Equivalent to GIGABYTES.convert(memory, this).
static long toGigaBytes(String memory)
           
 long toKiloBytes(long memory)
          Equivalent to KILOBYTES.convert(memory, this).
static long toKiloBytes(String memory)
           
 long toMegaBytes(long memory)
          Equivalent to MEGABYTES.convert(memory, this).
static long toMegaBytes(String memory)
           
 long toPetaBytes(long memory)
          Equivalent to PETABYTES.convert(memory, this).
static long toPetaBytes(String memory)
           
 String toPostfix()
           
 long toTeraBytes(long memory)
          Equivalent to TERABYTES.convert(memory, this).
static long toTeraBytes(String memory)
           
static MemoryUnit valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MemoryUnit[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

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 Detail

values

public static MemoryUnit[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MemoryUnit c : MemoryUnit.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MemoryUnit valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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:
convert(long, org.openspaces.core.util.MemoryUnit)

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:
convert(long, org.openspaces.core.util.MemoryUnit)

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:
convert(long, org.openspaces.core.util.MemoryUnit)

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:
convert(long, org.openspaces.core.util.MemoryUnit)

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:
convert(long, org.openspaces.core.util.MemoryUnit)

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:
convert(long, org.openspaces.core.util.MemoryUnit)

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:
convert(long, org.openspaces.core.util.MemoryUnit)

toExaBytes

public static long toExaBytes(String memory)

toPostfix

public String toPostfix()

getPostfix

public String getPostfix()

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.