Module bus.http

Class NOS

java.lang.Object
org.miaixz.bus.http.metric.anget.UserAgent
org.miaixz.bus.http.metric.anget.NOS

public class NOS extends UserAgent
Represents a Network Operating System (NOS), typically parsed from a User-Agent string.
Since:
Java 17+
Author:
Kimi Liu
  • Field Details

    • UNKNOWN

      public static final NOS UNKNOWN
      Constant for an unknown operating system.
    • NOS

      public static final List<NOS> NOS
      A list of supported operating systems.
  • Constructor Details

    • NOS

      public NOS(String name, String rule)
      Constructs a new NOS instance.
      Parameters:
      name - The name of the operating system.
      rule - The keyword or expression to match.
    • NOS

      public NOS(String name, String rule, String versionRegex)
      Constructs a new NOS instance.
      Parameters:
      name - The name of the operating system.
      rule - The keyword or expression to match.
      versionRegex - The regex for matching the version.
  • Method Details

    • addOs

      public static void addOs(String name, String rule, String versionRegex)
      Adds a custom operating system type to the list of supported OSes.
      Parameters:
      name - The name of the OS.
      rule - The keyword or expression to match.
      versionRegex - The regex for matching the version.
    • getVersion

      public String getVersion(String userAgent)
      Gets the version of the operating system from a User-Agent string.
      Parameters:
      userAgent - The User-Agent string.
      Returns:
      The version string, or null if not found.
    • isMacOS

      public boolean isMacOS()
      Returns whether this operating system is macOS.
      Returns:
      true if this is macOS, false otherwise.