Skip to content
Advertisement

How can I display a byte array as a String in java’s debug detail formatter?

I’d like to write a simple detail formatter that displays byte[] data in the form of a String (using String.<init>([B) to do the dirty work).

However, I’m not sure how to find the class name for [B to use when creating the formatter. Is this even possible? Or, alternatively, is there another way to view byte arrays as strings in the debugger?

Advertisement

Answer

I don’t know how to get eclipse’s detail formatter to automagically display byte arrays as Strings, but you can display a particular byte array by adding new String(byteArray) as a watch expression.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement