public static InetAddress getByAddress ( String host , byte [ ] addr , int scopeId ) throws UnknownHostException { if ( host != null && host . length ( ) > 0 && host . charAt ( 0 ) == ' ' ) { if ( host . charAt ( host . length ( ) - 1 ) == ' ' ) { host = host . substring ( 1 , host . length ( ) - 1 ) ; } } if ( addr != null ) { if ( addr . length == Inet4Address . INADDRSZ ) { return new Inet4Address ( host , addr ) ; } else if ( addr . length == Inet6Address . INADDRSZ ) { byte [ ] newAddr = IPAddressUtil . convertFromIPv4MappedAddress ( addr ) ; if ( newAddr != null ) { return new Inet4Address ( host , newAddr ) ; } else { return new Inet6Address ( host , addr , scopeId ) ; } } } throw new UnknownHostException ( "addr is of illegal length" ) ; }
Do not delete . Called from native code .