When debugging in IntelliJ you may need to inspect byte arrays as these byte arrays may contain meaningful text. Out of the box individual byte array values will be rendered as numeric byte values. This makes it difficult to decipher what it is you're debugging.

Fortunately IntelliJ gives a way to customize your data views when debugging. The way to handle this is create a custom Type Renderer. While inspecting values during a debug session, in the Frame tab right click and select "Customize Data Views...". A dialog will appear, select the Type Renderers tab. IntelliJ allows you to create a renderer for objects of a particular type. Apply renderer to a byte[] and use the expression "new String(this)".

This will render the byte array as a String:
For cases when you don't want this type renderer enabled, IntelliJ allows you to disable the renderer by unchecking the checkbox next to the renderer name.
0 TrackBacks
Listed below are links to blogs that reference this entry: IntelliJ Type Renderers.
TrackBack URL for this entry: http://www.nearinfinity.com/mt/mt-tb.cgi/448



Leave a comment