MCPcopy Create free account
hub / github.com/e2wugui/zeze / toStr

Method toStr

ZezeJava/ZezeJava/src/main/java/Zeze/Util/DumpRocksDb.java:343–357  ·  view source on GitHub ↗
(byte @NotNull [] bytes)

Source from the content-addressed store, hash-verified

341 }
342
343 private static String toStr(byte @NotNull [] bytes) {
344 var sb = new StringBuilder(bytes.length * 3);
345 for (int b : bytes) {
346 if (b >= 0x20 && b <= 0x7e) { // printable
347 if (b == '\'' || b == '\\') // escape
348 sb.append('\\');
349 sb.append((char)b);
350 } else {
351 sb.append('\\');
352 sb.append((char)num2Hex((b >> 4) & 0xf));
353 sb.append((char)num2Hex(b & 0xf));
354 }
355 }
356 return sb.toString();
357 }
358
359 private static boolean isUtf8(byte @NotNull [] bytes) {
360 for (int i = 0, n = bytes.length; i < n; i++) {

Callers 2

dumpRaftLogMethod · 0.95
DumpRocksDbClass · 0.95

Calls 3

appendMethod · 0.45
num2HexMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected