Class AbstractNetworkParams

java.lang.Object
oshi.software.common.AbstractNetworkParams
All Implemented Interfaces:
NetworkParams
Direct Known Subclasses:
OpenBsdNetworkParams

@ThreadSafe public abstract class AbstractNetworkParams extends Object implements NetworkParams
Common NetworkParams implementation.
  • Constructor Details

    • AbstractNetworkParams

      public AbstractNetworkParams()
  • Method Details

    • getDomainName

      public String getDomainName()
      Description copied from interface: NetworkParams
      Gets the Domain Name of the machine executing OSHI.
      Specified by:
      getDomainName in interface NetworkParams
      Returns:
      the domain name
    • getHostName

      public String getHostName()
      Description copied from interface: NetworkParams
      Gets the HostName of the machine executing OSHI.
      Specified by:
      getHostName in interface NetworkParams
      Returns:
      the hostname
    • getDnsServers

      public String[] getDnsServers()
      Description copied from interface: NetworkParams
      Gets the DNS Servers configured for this machine.
      Specified by:
      getDnsServers in interface NetworkParams
      Returns:
      the DNS servers
    • searchGateway

      protected static String searchGateway(List<String> lines)
      Convenience method to parse the output of the `route` command. While the command arguments vary between OS's the output is consistently parsable.
      Parameters:
      lines - output of OS-specific route command
      Returns:
      default gateway
    • toString

      public String toString()
      Overrides:
      toString in class Object