简体   繁体   English

如何在Java的jdb调试器中打印数组?

[英]How do I print an array in Java's jdb debugger?

How do I print out the values of the byte array all at once? 如何一次打印出字节数组的值? I seem to recall I could specify a memory range in gdb. 我似乎记得我可以在gdb中指定一个内存范围。 Is similar functionality is available in jdb? jdb中是否有类似的功能?

I have a Java byte array: 我有一个Java字节数组:

byte [] decompressed = new byte[OUTPUT_FILE_IO_BUFFER_SIZE];

which I populate from a String: 我从一个字符串填充:

System.arraycopy(decompressedString.getBytes(), 0, decompressed, 0, 
                         decompressedString.length());

In jdb, I want to print the contents of the byte array. 在jdb中,我想打印字节数组的内容。 I tried 我试过了

main[1] print decompressed

which returns: 返回:

 decompressed = instance of byte[7] (id=342)

One solution: 一个解决方案

dump decompressed

This dumps the byte values! 这会转储字节值! :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM