|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<MemoryUnit> net.sf.ehcache.config.MemoryUnit
public enum MemoryUnit
Memory unit: byte-based
Enum Constant Summary | |
---|---|
BYTES
BYTES |
|
GIGABYTES
GIGABYTES (1024 MEGABYTES) |
|
KILOBYTES
KILOBYTES (1024 BYTES) |
|
MEGABYTES
MEGABYTES (1024 KILOBYTES) |
Method Summary | |
---|---|
static MemoryUnit |
forUnit(char unit)
Returns the MemoryUnit instance based on provided char |
char |
getUnit()
Retrieves the unit character for the MemoryUnit |
static long |
parseAmount(String value)
Parses the amount represented by the string, without caring for the unit |
static long |
parseSizeInBytes(String value)
Parses the string for its content, returning the represented value in bytes |
static MemoryUnit |
parseUnit(String value)
Parses the unit part of a String, if no unit char available, returns BYTES |
abstract long |
toBytes(long amount)
returns the amount in bytes |
abstract long |
toGigaBytes(long amount)
returns the amount in gigabytes |
abstract long |
toKiloBytes(long amount)
returns the amount in kilobytes |
abstract long |
toMegaBytes(long amount)
returns the amount in megabytes |
String |
toString(long amount)
Human readable value, with the added unit character as a suffix |
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 |
---|
public static final MemoryUnit BYTES
public static final MemoryUnit KILOBYTES
public static final MemoryUnit MEGABYTES
public static final MemoryUnit GIGABYTES
Method Detail |
---|
public static MemoryUnit[] values()
for (MemoryUnit c : MemoryUnit.values()) System.out.println(c);
public static MemoryUnit valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic char getUnit()
public abstract long toBytes(long amount)
amount
- of the unit
public abstract long toKiloBytes(long amount)
amount
- of the unit
public abstract long toMegaBytes(long amount)
amount
- of the unit
public abstract long toGigaBytes(long amount)
amount
- of the unit
public String toString(long amount)
amount
- the amount to print
public static MemoryUnit forUnit(char unit) throws IllegalArgumentException
unit
- the unit to look for
IllegalArgumentException
- if no matching MemoryUnit matching the charpublic static MemoryUnit parseUnit(String value)
BYTES
value
- the String representation of an amount of memory
public static long parseAmount(String value) throws NumberFormatException
value
- the String representation of an amount of memory
NumberFormatException
- if not a number (with potential unit char stripped)public static long parseSizeInBytes(String value) throws NumberFormatException, IllegalArgumentException
value
- the String representation of an amount of memory
NumberFormatException
- if not a number (with potential unit char stripped)
IllegalArgumentException
- if no matching MemoryUnit matching the char
|
ehcache | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |