com.atlassian.util.concurrent
Class Memory

java.lang.Object
  extended by com.atlassian.util.concurrent.Memory

public class Memory
extends Object

Value representing an amount of Memory, as measured in memory units.

Since:
2.5

Nested Class Summary
static class Memory.MemoryComparator
          Comparator for units.
static class Memory.Unit
          Units in which memory is expressed.
static class Memory.UnitComparator
          Comparator for units.
 
Method Summary
 long bytes()
          The number of bytes represented by this instance.
static Memory bytes(long number)
          Construct a Memory represented in bytes.
 boolean equals(Object obj)
           
static Memory gigabytes(long number)
          Construct a Memory represented in gigabytes.
 int hashCode()
           
static Memory kilobytes(long number)
          Construct a Memory represented in kilobytes.
static Memory megabytes(long number)
          Construct a Memory represented in megabytes.
 long number()
          The number of units this represents.
static Memory of(long number, Memory.Unit unit)
          Construct a Memory represented in the supplied unit type.
static Memory terabytes(long number)
          Construct a Memory represented in terabytes.
 Memory to(Memory.Unit unit)
          Convert to the supplied unit representation.
 String toString()
           
 Memory.Unit unit()
          The memory Memory.Unit this is represented in.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

of

public static Memory of(long number,
                        Memory.Unit unit)
Construct a Memory represented in the supplied unit type.


bytes

public static Memory bytes(long number)
Construct a Memory represented in bytes.


kilobytes

public static Memory kilobytes(long number)
Construct a Memory represented in kilobytes.


megabytes

public static Memory megabytes(long number)
Construct a Memory represented in megabytes.


gigabytes

public static Memory gigabytes(long number)
Construct a Memory represented in gigabytes.


terabytes

public static Memory terabytes(long number)
Construct a Memory represented in terabytes.


number

public long number()
The number of units this represents.


unit

public Memory.Unit unit()
The memory Memory.Unit this is represented in.


bytes

public long bytes()
The number of bytes represented by this instance.


to

public Memory to(Memory.Unit unit)
Convert to the supplied unit representation.

This may involve a loss of precision if the Unit is greater than the current representation. This will always round down to the nearest complete Unit. 2043B will be 1KB for instance.


toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2014 Atlassian. All Rights Reserved.