Package org.xbill.DNS
Class TTL
java.lang.Object
org.xbill.DNS.TTL
Routines for parsing BIND-style TTL values. These values consist of numbers followed by 1 letter
units of time (W - week, D - day, H - hour, M - minute, S - second).
- Author:
- Brian Wellington
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat(long ttl) static longParses a TTL-like value, which can either be expressed as a number or a BIND-style string with numbers and units.static longParses a TTL, which can either be expressed as a number or a BIND-style string with numbers and units.
-
Field Details
-
MAX_VALUE
public static final long MAX_VALUE- See Also:
-
-
Method Details
-
parse
Parses a TTL-like value, which can either be expressed as a number or a BIND-style string with numbers and units.- Parameters:
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.- Returns:
- The value as a number of seconds
- Throws:
NumberFormatException- The string was not in a valid TTL format.
-
parseTTL
Parses a TTL, which can either be expressed as a number or a BIND-style string with numbers and units.- Parameters:
s- The string representing the TTL- Returns:
- The TTL as a number of seconds
- Throws:
NumberFormatException- The string was not in a valid TTL format.
-
format
-