IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
IKVM.Runtime.Util.Java.Net.InetAddressExtensions Class Reference

Extension methods for working with Internet Addrsses. More...

Static Public Member Functions

static IPAddress ToIPAddress (this java.net.InetAddress self)
 Gets a IPAddress for the given java.net.InetAddress.
 
static java.net.InetAddress ToInetAddress (this IPAddress address)
 Gets a java.net.InetAddress for the given IPAddress.
 
static java.net.InetAddress ToInetAddress (this IPAddress address, string hostname)
 Gets a java.net.InetAddress for the given IPAddress.
 
static java.net.InetAddress ToInetAddress (this IPEndPoint self)
 Gets a java.net.InetAddress for the given IPEndPoint.
 

Detailed Description

Extension methods for working with Internet Addrsses.

Definition at line 9 of file InetAddressExtensions.cs.

Member Function Documentation

◆ ToInetAddress() [1/3]

static java.net.InetAddress IKVM.Runtime.Util.Java.Net.InetAddressExtensions.ToInetAddress ( this IPAddress address)
static

Gets a java.net.InetAddress for the given IPAddress.

Parameters
address
Returns

Definition at line 34 of file InetAddressExtensions.cs.

35 {
36 return address != null ? address.ToInetAddress(address.ToString()) : null;
37 }

◆ ToInetAddress() [2/3]

static java.net.InetAddress IKVM.Runtime.Util.Java.Net.InetAddressExtensions.ToInetAddress ( this IPAddress address,
string hostname )
static

Gets a java.net.InetAddress for the given IPAddress.

Parameters
address
hostname
Returns

Definition at line 45 of file InetAddressExtensions.cs.

46 {
47 if (address == null)
48 return null;
49 else if (address.IsIPv6LinkLocal || address.IsIPv6SiteLocal)
50 return java.net.Inet6Address.getByAddress(hostname, address.GetAddressBytes(), (int)address.ScopeId);
51 else
52 return java.net.InetAddress.getByAddress(hostname, address.GetAddressBytes());
53 }

◆ ToInetAddress() [3/3]

static java.net.InetAddress IKVM.Runtime.Util.Java.Net.InetAddressExtensions.ToInetAddress ( this IPEndPoint self)
static

Gets a java.net.InetAddress for the given IPEndPoint.

Parameters
self
Returns

Definition at line 60 of file InetAddressExtensions.cs.

61 {
62 return self != null ? self.Address.ToInetAddress() : null;
63 }

◆ ToIPAddress()

static IPAddress IKVM.Runtime.Util.Java.Net.InetAddressExtensions.ToIPAddress ( this java.net.InetAddress self)
static

Gets a IPAddress for the given java.net.InetAddress.

Parameters
self
Returns

Definition at line 19 of file InetAddressExtensions.cs.

20 {
21 if (self == null)
22 return null;
23 else if (self is java.net.Inet6Address ip6)
24 return new IPAddress(self.getAddress(), ip6.getScopeId());
25 else
26 return new IPAddress(self.getAddress());
27 }

The documentation for this class was generated from the following file: