Top Description Inners Fields Constructors Methods
net.sf.ehcache.util

public Class MemorySizeParser

extends Object
Class Inheritance

Memory size parser using the letter k or K to indicate kilobytes, the letter m or M to indicate megabytes, the letter g or G to indicate gigabytes and the letter t or T to indicate terabytes.
Author
Ludovic Orban

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
MemorySizeParser.MemorySize

Memory size calculator.

Field Summary

Modifier and TypeField and Description
private static final long
private static final long
private static final long
private static final long
private static final long

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static long

Returns:

the memory size in bytes.
parse
(String
the String containing a human-readable memory size.
configuredMemorySize
)

Parse a String containing a human-readable memory size.

private static MemorySizeParser.MemorySize
parseIncludingUnit(String configuredMemorySize)

private static MemorySizeParser.MemorySize
toMemorySize(String configuredMemorySize, long unitMultiplier)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BYTEback to summary
private static final long BYTE
GIGABYTEback to summary
private static final long GIGABYTE
KILOBYTEback to summary
private static final long KILOBYTE
MEGABYTEback to summary
private static final long MEGABYTE
TERABYTEback to summary
private static final long TERABYTE

Constructor Detail

MemorySizeParserback to summary
public MemorySizeParser()

Method Detail

parseback to summary
public static long parse(String configuredMemorySize) throws IllegalArgumentException

Parse a String containing a human-readable memory size.

Parameters
configuredMemorySize:String

the String containing a human-readable memory size.

Returns:long

the memory size in bytes.

Exceptions
IllegalArgumentException:
thrown when the configured memory size cannot be parsed.
parseIncludingUnitback to summary
private static MemorySizeParser.MemorySize parseIncludingUnit(String configuredMemorySize) throws IllegalArgumentException
toMemorySizeback to summary
private static MemorySizeParser.MemorySize toMemorySize(String configuredMemorySize, long unitMultiplier)
net.sf.ehcache.util back to summary

private final Class MemorySizeParser.MemorySize

extends Object
Class Inheritance

Memory size calculator.

Field Summary

Modifier and TypeField and Description
private String
private long

Constructor Summary

AccessConstructor and Description
private
MemorySize(String configuredMemorySizeWithoutUnit, long multiplicationFactor)

Method Summary

Modifier and TypeMethod and Description
public long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configuredMemorySizeWithoutUnitback to summary
private String configuredMemorySizeWithoutUnit
multiplicationFactorback to summary
private long multiplicationFactor

Constructor Detail

MemorySizeback to summary
private MemorySize(String configuredMemorySizeWithoutUnit, long multiplicationFactor)

Method Detail

calculateMemorySizeInBytesback to summary
public long calculateMemorySizeInBytes() throws IllegalArgumentException