java.lang.Object | |
↳ | java.net.NetworkInterface |
This class is used to represent a network interface of the local device. An interface is defined by its address and a platform dependent name. The class provides methods to get all information about the available interfaces of the system or to identify the local interface of a joined multicast group.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Compares the specified object to this
NetworkInterface and
returns whether they are equal or not. | |||||||||||
Returns the
NetworkInterface corresponding to the given address, or null if no
interface has this address. | |||||||||||
Returns the
NetworkInterface corresponding to the named network interface, or null
if no interface has this name. | |||||||||||
Returns a human-readable name for this network interface.
| |||||||||||
Returns the hardware address of the interface, if it has one, or null otherwise.
| |||||||||||
Returns an enumeration of the addresses bound to this network interface.
| |||||||||||
Returns a List of the InterfaceAddresses for this network interface.
| |||||||||||
Returns the Maximum Transmission Unit (MTU) of this interface.
| |||||||||||
Returns the name of this network interface (such as "eth0" or "lo").
| |||||||||||
Gets a list of all network interfaces available on the local system or
null if no interface is available. | |||||||||||
Returns the parent NetworkInterface of this interface if this is a
sub-interface, or null if it's a physical (non virtual) interface.
| |||||||||||
Returns an enumeration of all the sub-interfaces of this network interface.
| |||||||||||
Returns the hash code for this
NetworkInterface . | |||||||||||
Returns true if this network interface is a loopback interface.
| |||||||||||
Returns true if this network interface is a point-to-point interface.
| |||||||||||
Returns true if this network interface is up.
| |||||||||||
Returns true if this interface is a virtual interface (also called
a sub-interface).
| |||||||||||
Returns true if this network interface supports multicast.
| |||||||||||
Returns a string containing details of this network interface.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Compares the specified object to this NetworkInterface
and
returns whether they are equal or not. The object must be an instance of
NetworkInterface
with the same name, display name, and list
of interface addresses.
obj | the object to compare with this instance. |
---|
true
if the specified object is equal to this NetworkInterface
, false
otherwise.Returns the NetworkInterface
corresponding to the given address, or null if no
interface has this address.
SocketException | if an error occurs. |
---|---|
NullPointerException | if address == null .
|
Returns the NetworkInterface
corresponding to the named network interface, or null
if no interface has this name.
SocketException | if an error occurs. |
---|---|
NullPointerException | if interfaceName == null .
|
Returns a human-readable name for this network interface. On Android, this is the same
string as returned by getName()
.
Returns the hardware address of the interface, if it has one, or null otherwise.
SocketException | if an I/O error occurs. |
---|
Returns an enumeration of the addresses bound to this network interface.
Returns a List of the InterfaceAddresses for this network interface.
Returns the Maximum Transmission Unit (MTU) of this interface.
SocketException | if an I/O error occurs. |
---|
Returns the name of this network interface (such as "eth0" or "lo").
Gets a list of all network interfaces available on the local system or
null
if no interface is available.
NetworkInterface
instances representing the
available interfaces.SocketException | if an error occurs while getting the network interface information. |
---|
Returns the parent NetworkInterface of this interface if this is a sub-interface, or null if it's a physical (non virtual) interface.
Returns an enumeration of all the sub-interfaces of this network interface. Sub-interfaces are also known as virtual interfaces.
For example, eth0:1
would be a sub-interface of eth0
.
Returns the hash code for this NetworkInterface
. Since the
name should be unique for each network interface the hash code is
generated using the name.
Returns true if this network interface is a loopback interface.
SocketException | if an I/O error occurs. |
---|
Returns true if this network interface is a point-to-point interface. (For example, a PPP connection using a modem.)
SocketException | if an I/O error occurs. |
---|
Returns true if this network interface is up.
SocketException | if an I/O error occurs. |
---|
Returns true if this interface is a virtual interface (also called a sub-interface). Virtual interfaces are, on some systems, interfaces created as a child of a physical interface and given different settings (like address or MTU). Usually the name of the interface will the name of the parent followed by a colon (:) and a number identifying the child, since there can be several virtual interfaces attached to a single physical interface.
Returns true if this network interface supports multicast.
SocketException | if an I/O error occurs. |
---|
Returns a string containing details of this network interface. The exact format is deliberately unspecified. Callers that require a specific format should build a string themselves, using this class' accessor methods.