Package com.typesafe.config
Class ConfigMemorySize
java.lang.Object
com.typesafe.config.ConfigMemorySize
An immutable class representing an amount of memory. Use
static factory methods such as
ofBytes(BigInteger) to create instances.- Since:
- 1.3.0
-
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()static ConfigMemorySizeofBytes(long bytes) Constructs a ConfigMemorySize representing the given number of bytes.static ConfigMemorySizeofBytes(BigInteger bytes) Constructs a ConfigMemorySize representing the given number of bytes.longtoBytes()Gets the size in bytes.Gets the size in bytes.toString()
-
Method Details
-
ofBytes
Constructs a ConfigMemorySize representing the given number of bytes.- Parameters:
bytes- a number of bytes- Returns:
- an instance representing the number of bytes
- Since:
- 1.3.0
-
ofBytes
Constructs a ConfigMemorySize representing the given number of bytes.- Parameters:
bytes- a number of bytes- Returns:
- an instance representing the number of bytes
-
toBytes
public long toBytes()Gets the size in bytes.- Returns:
- how many bytes
- Throws:
IllegalArgumentException- when memory value in bytes doesn't fit in a long value. Consider usingtoBytesBigInteger()in this case.- Since:
- 1.3.0
-
toBytesBigInteger
Gets the size in bytes. The behavior of this method is the same as that of thetoBytes()method, except that the number of bytes returned as a BigInteger value. Use it when memory value in bytes doesn't fit in a long value.- Returns:
- how many bytes
-
toString
-
equals
-
hashCode
public int hashCode()
-