-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverse toString parsing for InetAddresses. #6713
Comments
Are these cases in which it's not guaranteed that the string was generated from |
Hi netdpb! May I take this issue? |
Thanks for your response! If the string does not contain '/', then this string was not generated from InetAddress.toString(). Otherwise, individually check the legality of each part generated by split() to ensure that this string can be generated by some InetAddress.toString(). If the verification confirms its legitimacy, return the corresponding Inet4Address or Inet6Address. |
Thanks. We still have questions about the usefulness of this feature. How many people need such an API? (We have seen no need for it within Google.) If you're serializing Another question for @rhuffy: The code snippet you provided passes the |
Hi @netdpb, I'd like to work on this issue, too. I think we can create a new static method that does the exact opposite of |
Hi @blackdurumi. Until we have a better sense of why such a feature would be actually useful to people, we won't accept it as an API addition. Additionally, there are questions about whether it's even possible (or desirable) to round-trip the scope ID. |
InetAddress.toString() outputs a string in the format
<hostname>/<address>
. I have use cases where I need to convert this string back to an Inet4Address or Inet6Address, which I think would be useful to include in Guava's InetAddresses class.The code I'm using currently looks like this:
The text was updated successfully, but these errors were encountered: