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

Method formatString

src/main/java/core/org/xbill/DNS/utils/base64.java:69–86  ·  view source on GitHub ↗

Formats data into a nicely formatted base64 encoded String @param b An array containing binary data @param lineLength The number of characters per line @param prefix A string prefixing the characters on each line @param addClose Whether to add a close parenthesis or not @return A String representing

(byte [] b, int lineLength, String prefix, boolean addClose)

Source from the content-addressed store, hash-verified

67 * @return A String representing the formatted output
68 */
69public static String
70formatString(byte [] b, int lineLength, String prefix, boolean addClose) {
71 String s = toString(b);
72 StringBuffer sb = new StringBuffer();
73 for (int i = 0; i < s.length(); i += lineLength) {
74 sb.append (prefix);
75 if (i + lineLength >= s.length()) {
76 sb.append(s.substring(i));
77 if (addClose)
78 sb.append(" )");
79 }
80 else {
81 sb.append(s.substring(i, i + lineLength));
82 sb.append("\n");
83 }
84 }
85 return sb.toString();
86}
87
88
89/**

Callers 6

rrToStringMethod · 0.80
rrToStringMethod · 0.80
rrToStringMethod · 0.80
rrToStringMethod · 0.80
rrToStringMethod · 0.80
rrToStringMethod · 0.80

Calls 3

toStringMethod · 0.95
lengthMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected