< prev index next >

src/java.base/share/classes/java/net/InetAddress.java

Print this page
*** 329,10 ***
--- 329,25 ---
                          throws UnknownHostException
                      {
                          return InetAddress.getByName(hostName, hostAddress);
                      }
  
+                     public Inet4Address getByAddress(int address) {
+                         return new Inet4Address(null, address);
+                     }
+ 
+                     public InetAddress getByAddress(byte[] addr,
+                                                     int scope_id) {
+                         assert addr.length == Inet6Address.INADDRSZ;
+                         if (IPAddressUtil.isIPv4MappedAddress(addr)) {
+                             assert scope_id == 0;
+                             return getByAddress(IPAddressUtil.intFromIPv4MappedAddress(addr));
+                         } else {
+                             return new Inet6Address(addr, scope_id);
+                         }
+                     }
+ 
                      public int addressValue(Inet4Address inet4Address) {
                          return inet4Address.addressValue();
                      }
  
                      public byte[] addressBytes(Inet6Address inet6Address) {
< prev index next >