@PublicEvolving public class MemorySize extends Object implements Serializable
The size can be parsed from a text expression. If the expression is a pure number, the value will be interpreted as bytes.
To make larger values more compact, the common size suffixes are supported:
Constructor and Description |
---|
MemorySize(long bytes)
Constructs a new MemorySize.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
long |
getBytes()
Gets the memory size in bytes.
|
long |
getGibiBytes()
Gets the memory size in Gibibytes (= 1024 Mebibytes).
|
long |
getKibiBytes()
Gets the memory size in Kibibytes (= 1024 bytes).
|
long |
getMebiBytes()
Gets the memory size in Mebibytes (= 1024 Kibibytes).
|
long |
getTebiBytes()
Gets the memory size in Tebibytes (= 1024 Gibibytes).
|
int |
hashCode() |
static MemorySize |
parse(String text)
Parses the given string as as MemorySize.
|
static long |
parseBytes(String text)
Parses the given string as bytes.
|
String |
toString() |
public MemorySize(long bytes)
bytes
- The size, in bytes. Must be zero or larger.public long getBytes()
public long getKibiBytes()
public long getMebiBytes()
public long getGibiBytes()
public long getTebiBytes()
public static MemorySize parse(String text) throws IllegalArgumentException
MemorySize
.text
- The string to parseIllegalArgumentException
- Thrown, if the expression cannot be parsed.public static long parseBytes(String text) throws IllegalArgumentException
MemorySize
.text
- The string to parseIllegalArgumentException
- Thrown, if the expression cannot be parsed.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.