public final class TTL
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static long |
MAX_VALUE |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
format(long ttl) |
static long |
parse(java.lang.String s,
boolean clamp)
Parses a TTL-like value, which can either be expressed as a number or a
BIND-style string with numbers and units.
|
static long |
parseTTL(java.lang.String s)
Parses a TTL, which can either be expressed as a number or a BIND-style
string with numbers and units.
|
public static final long MAX_VALUE
public static long parse(java.lang.String s,
boolean clamp)
s - The string representing the numeric value.clamp - Whether to clamp values in the range [MAX_VALUE + 1, 2^32 -1]
to MAX_VALUE. This should be donw for TTLs, but not other values which
can be expressed in this format.java.lang.NumberFormatException - The string was not in a valid TTL format.public static long parseTTL(java.lang.String s)
s - The string representing the TTLjava.lang.NumberFormatException - The string was not in a valid TTL format.public static java.lang.String format(long ttl)