java.lang.Object
org.miaixz.bus.http.metric.anget.UserAgent
org.miaixz.bus.http.metric.anget.NOS
Represents a Network Operating System (NOS), typically parsed from a User-Agent string.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a custom operating system type to the list of supported OSes.getVersion(String userAgent) Gets the version of the operating system from a User-Agent string.booleanisMacOS()Returns whether this operating system is macOS.
-
Field Details
-
UNKNOWN
Constant for an unknown operating system. -
NOS
A list of supported operating systems.
-
-
Constructor Details
-
NOS
Constructs a newNOSinstance.- Parameters:
name- The name of the operating system.rule- The keyword or expression to match.
-
NOS
Constructs a newNOSinstance.- 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
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
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:
trueif this is macOS,falseotherwise.
-