Class AbstractNetworkParams

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

@ThreadSafe
public abstract class AbstractNetworkParams
extends java.lang.Object
implements NetworkParams
Common NetworkParams implementation.
  • Constructor Summary

    Constructors
    Constructor Description
    AbstractNetworkParams()  
  • Method Summary

    Modifier and Type Method Description
    java.lang.String[] getDnsServers()
    Gets the DNS Servers configured for this machine.
    java.lang.String getDomainName()
    Gets the Domain Name of the machine executing OSHI.
    java.lang.String getHostName()
    Gets the HostName of the machine executing OSHI.
    protected static java.lang.String searchGateway​(java.util.List<java.lang.String> lines)
    Convenience method to parse the output of the `route` command.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface oshi.software.os.NetworkParams

    getIpv4DefaultGateway, getIpv6DefaultGateway
  • Constructor Details

    • AbstractNetworkParams

      public AbstractNetworkParams()
  • Method Details

    • getDomainName

      public java.lang.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 java.lang.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 java.lang.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 java.lang.String searchGateway​(java.util.List<java.lang.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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object