Class MacNetworkIF

java.lang.Object
oshi.hardware.common.AbstractNetworkIF
oshi.hardware.common.platform.mac.MacNetworkIF
All Implemented Interfaces:
NetworkIF

@ThreadSafe public abstract class MacNetworkIF extends AbstractNetworkIF
Base class for macOS NetworkIF implementations. Subclasses provide platform-specific display name resolution and network statistics updates.
  • Constructor Details

  • Method Details

    • getIfType

      public int getIfType()
      Description copied from interface: NetworkIF
      (Windows, macOS) The NDIS Interface Type. NDIS interface types are registered with the Internet Assigned Numbers Authority (IANA), which publishes a list of interface types periodically in the Assigned Numbers RFC, or in a derivative of it that is specific to Internet network management number assignments.

      (Linux) ARP Protocol hardware identifiers defined in include/uapi/linux/if_arp.h

      Returns:
      the ifType
    • getBytesRecv

      public long getBytesRecv()
      Description copied from interface: NetworkIF

      Getter for the field bytesRecv.

      Returns:
      The Bytes Received.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getBytesSent

      public long getBytesSent()
      Description copied from interface: NetworkIF

      Getter for the field bytesSent.

      Returns:
      The Bytes Sent.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getPacketsRecv

      public long getPacketsRecv()
      Description copied from interface: NetworkIF

      Getter for the field packetsRecv.

      Returns:
      The Packets Received.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getPacketsSent

      public long getPacketsSent()
      Description copied from interface: NetworkIF

      Getter for the field packetsSent.

      Returns:
      The Packets Sent.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getInErrors

      public long getInErrors()
      Description copied from interface: NetworkIF

      Getter for the field inErrors.

      Returns:
      Input Errors.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getOutErrors

      public long getOutErrors()
      Description copied from interface: NetworkIF

      Getter for the field outErrors.

      Returns:
      The Output Errors.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getInDrops

      public long getInDrops()
      Description copied from interface: NetworkIF

      Getter for the field inDrops.

      Returns:
      Incoming/Received dropped packets. On Windows, returns discarded incoming packets.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getCollisions

      public long getCollisions()
      Description copied from interface: NetworkIF

      Getter for the field collisions.

      Returns:
      Packet collisions. On Windows, returns discarded outgoing packets.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getSpeed

      public long getSpeed()
      Description copied from interface: NetworkIF

      Getter for the field speed.

      Returns:
      The speed of the network interface in bits per second.

      This value is set when the NetworkIF is instantiated and may not be up to date. To update this value, execute the NetworkIF.updateAttributes() method

    • getTimeStamp

      public long getTimeStamp()
      Description copied from interface: NetworkIF

      Getter for the field timeStamp.

      Returns:
      Returns the timeStamp.
    • setIfType

      protected void setIfType(int ifType)
    • setBytesRecv

      protected void setBytesRecv(long bytesRecv)
    • setBytesSent

      protected void setBytesSent(long bytesSent)
    • setPacketsRecv

      protected void setPacketsRecv(long packetsRecv)
    • setPacketsSent

      protected void setPacketsSent(long packetsSent)
    • setInErrors

      protected void setInErrors(long inErrors)
    • setOutErrors

      protected void setOutErrors(long outErrors)
    • setInDrops

      protected void setInDrops(long inDrops)
    • setCollisions

      protected void setCollisions(long collisions)
    • setSpeed

      protected void setSpeed(long speed)
    • setTimeStamp

      protected void setTimeStamp(long timeStamp)