Android API-23: InetAddressUtils replacement

后端 未结 5 1988
误落风尘
误落风尘 2020-12-30 01:07

Switching to Android Marshmallow API, I was using org.apache.http.conn.util.InetAddressUtils for InetAddressUtils.isIPv4Address(ipAddress) in a cod

5条回答
  •  天命终不由人
    2020-12-30 01:43

    Using try catch as logic is horrible practice and should only be done if totally unavoidable..

    Use something like this instead:

    if (inetAddress instanceof Inet4Address){
        //do something
    }  
    

提交回复
热议问题