MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / byteArrayToString

Method byteArrayToString

src/main/java/core/org/xbill/DNS/Record.java:400–419  ·  view source on GitHub ↗

Converts a byte array into a String.

(byte [] array, boolean quote)

Source from the content-addressed store, hash-verified

398 * Converts a byte array into a String.
399 */
400protected static String
401byteArrayToString(byte [] array, boolean quote) {
402 StringBuffer sb = new StringBuffer();
403 if (quote)
404 sb.append('"');
405 for (int i = 0; i < array.length; i++) {
406 int b = array[i] & 0xFF;
407 if (b < 0x20 || b >= 0x7f) {
408 sb.append('\\');
409 sb.append(byteFormat.format(b));
410 } else if (b == '"' || b == '\\') {
411 sb.append('\\');
412 sb.append((char)b);
413 } else
414 sb.append((char)b);
415 }
416 if (quote)
417 sb.append('"');
418 return sb.toString();
419}
420
421/**
422 * Converts a byte array into the unknown RR format.

Callers 15

getAddressMethod · 0.80
getSubAddressMethod · 0.80
rrToStringMethod · 0.80
rrToStringMethod · 0.80
getTargetMethod · 0.80
getCPUMethod · 0.80
getOSMethod · 0.80
rrToStringMethod · 0.80
rrToStringMethod · 0.80
getStringsMethod · 0.80
getAddressMethod · 0.80
rrToStringMethod · 0.80

Calls 3

appendMethod · 0.45
formatMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected