HCOLL-134 ( release draft cut of the code so that I can test it across my network )

This commit is contained in:
Rob Austin
2014-10-06 15:30:30 +01:00
parent 1d27ca894b
commit a655b877a2
2 changed files with 17 additions and 1 deletions
@@ -594,10 +594,27 @@ class AddressAndPort implements Comparable<AddressAndPort>, BytesMarshallable {
'}';
}
final static int INADDRSZ = 16;
final static int INT16SZ = 2;
static String numericToTextFormat(byte[] src) {
if (src.length == 4) {
return (src[0] & 0xff) + "." + (src[1] & 0xff) + "." + (src[2] & 0xff) + "." + (src[3] & 0xff);
}
if (src.length == 6) {
StringBuffer sb = new StringBuffer(39);
for (int i = 0; i < (INADDRSZ / INT16SZ); i++) {
sb.append(Integer.toHexString(((src[i << 1] << 8) & 0xff00)
| (src[(i << 1) + 1] & 0xff)));
if (i < (INADDRSZ / INT16SZ) - 1) {
sb.append(":");
}
}
return sb.toString();
}
throw new UnsupportedOperationException();
}