dweiss commented on code in PR #13068:
URL: https://github.com/apache/lucene/pull/13068#discussion_r1483384841
##########
lucene/core/src/java/org/apache/lucene/util/ToStringUtils.java:
##########
@@ -32,11 +32,37 @@ public static void byteArray(StringBuilder buffer, byte[]
bytes) {
private static final char[] HEX = "0123456789abcdef".toCharArray();
+ /**
+ * Unlike {@link Long#toHexString(long)} returns a String with a "0x" prefix
and all the leading
+ * zeros.
+ */
public static String longHex(long x) {
char[] asHex = new char[16];
for (int i = 16; --i >= 0; x >>>= 4) {
asHex[i] = HEX[(int) x & 0x0F];
}
return "0x" + new String(asHex);
}
+
+ @SuppressWarnings("unused")
+ public static String brToString(BytesRef b) {
Review Comment:
I think this method could be the default toString on BytesRef, actually...
in most cases when you wish to dump it using toString it's for debugging
purposes: an array of bytes would always be there, utf8 as an additional
helpful hint... why add another method? Even the fact that this additional
method exists points at the need to actually dump BytesRef in a more verbose
way...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]