I need to do a manual conversion of a string representation of IPv6 to a byte array. I'm on an embedded device and don't have access to external libraries.
For example:
String addr_str = "bbbb::1"
with manual conversion would be:
byte[] addr = new byte[]{(byte) 187,(byte) 187,0,0 //187 == bb
,0,0,0,0
,0,0,0,0
,0,0,0,1};
Ideally, I would like to create a function, like 'convertToIPv6ByteArray', that would enable:
addr = convertToIPv6ByteArray(addr_str);
I'm having difficulties implementing this function efficiently though. Any help?