Class Golang

  • public class Golang
    extends Object
    Helper methods that have to do with certain golang-specific format the server uses.
    • Constructor Detail

      • Golang

        public Golang()
    • Method Detail

      • encodeDurationToMs

        public static String encodeDurationToMs​(Duration duration)
        Encodes a Java duration into the encoded golang format.
        duration - the duration to encode.
        the encoded duration.
      • parseDuration

        public static Duration parseDuration​(String duration)
        Parses a Go duration string using the same rules as Go's time.ParseDuration method.

        A Go duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The unit suffix may be omitted if the duration is "0".

        The internal representation is a signed long number of nanoseconds. This means the longest possible duration is approximately 290 years.

        InvalidArgumentException - if the input does not match the Go duration string syntax or if it describes a duration longer than 2^63−1 nanoseconds.