public final class SingletonDnsServerAddresses extends java.lang.Object implements DnsServerAddressStream
DnsServerAddressStream
which always returns the same InetSocketAddress
.Constructor and Description |
---|
SingletonDnsServerAddresses(java.net.InetSocketAddress address)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
DnsServerAddressStream |
duplicate()
Duplicate this object.
|
java.net.InetSocketAddress |
next()
Retrieves the next DNS server address from the stream.
|
int |
size()
Get the number of times
DnsServerAddressStream.next() will return a distinct element before repeating or terminating. |
java.lang.String |
toString() |
public SingletonDnsServerAddresses(java.net.InetSocketAddress address)
address
- the address to return in next()
.public java.net.InetSocketAddress next()
DnsServerAddressStream
next
in interface DnsServerAddressStream
public int size()
DnsServerAddressStream
DnsServerAddressStream.next()
will return a distinct element before repeating or terminating.size
in interface DnsServerAddressStream
DnsServerAddressStream.next()
will return a distinct element before repeating or terminating.public DnsServerAddressStream duplicate()
DnsServerAddressStream
DnsServerAddressStream.next()
.
Note that Object.clone()
isn't used because it may make sense for some implementations to have the
following relationship x.duplicate() == x
.
duplicate
in interface DnsServerAddressStream
public java.lang.String toString()
toString
in class java.lang.Object