TTL (dnsjava documentation)
Date: 2013-04-10

org.xbill.DNS

## Class TTL

- java.lang.Object
- - org.xbill.DNS.TTL

-     public final class TTL
      extends Object

  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
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `MAX_VALUE`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `format(long ttl)`
    `static long` | `parse(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(String s)` Parses a TTL, which can either be expressed as a number or a BIND-style string with numbers and units.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### MAX_VALUE

          public static final long MAX_VALUE

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### parse

          public static long parse(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.
      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

          public static long parseTTL(String s)

      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

          public static String format(long ttl)