public final class MemorySize extends Object
MemoryUnit
.MemoryUnit
Constructor and Description |
---|
MemorySize(long value) |
MemorySize(long value,
MemoryUnit unit) |
Modifier and Type | Method and Description |
---|---|
long |
bytes()
Returns value of memory size in bytes.
|
boolean |
equals(Object o) |
MemoryUnit |
getUnit()
Returns unit of memory size
|
long |
getValue()
Returns value of memory size in its original unit.
|
long |
gigaBytes()
Returns value of memory size in giga-bytes.
|
int |
hashCode() |
long |
kiloBytes()
Returns value of memory size in kilo-bytes.
|
long |
megaBytes()
Returns value of memory size in mega-bytes.
|
static MemorySize |
parse(String value)
Parses string representation of a memory size value.
|
static MemorySize |
parse(String value,
MemoryUnit defaultUnit)
Parses string representation of a memory size value.
|
String |
toPrettyString()
Returns a pretty format String representation of this memory size.
|
static String |
toPrettyString(long size)
Utility method to create a pretty format representation of given value in bytes.
|
static String |
toPrettyString(long size,
MemoryUnit unit)
Utility method to create a pretty format representation of given value in given unit.
|
String |
toString() |
public MemorySize(long value)
public MemorySize(long value, MemoryUnit unit)
public long getValue()
public MemoryUnit getUnit()
public long bytes()
public long kiloBytes()
public long megaBytes()
public long gigaBytes()
public static MemorySize parse(String value)
Default unit is bytes.
Examples: 12345, 12345m, 12345K, 123456G
public static MemorySize parse(String value, MemoryUnit defaultUnit)
Uses default unit if value does not contain unit information.
Examples: 12345, 12345m, 12345K, 123456G
public String toPrettyString()
public static String toPrettyString(long size)
size
- size in bytespublic static String toPrettyString(long size, MemoryUnit unit)
size
- memory sizeunit
- memory unitCopyright © 2021 Hazelcast, Inc.. All rights reserved.