代码之家  ›  专栏  ›  技术社区  ›  iokevins

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

  •  3
  • iokevins  · 技术社区  · 15 年前

    如何一次打印出字节数组的所有值?我似乎记得我可以在gdb中指定一个内存范围。jdb中是否有类似的功能?

    我有一个Java字节数组:

    byte [] decompressed = new byte[OUTPUT_FILE_IO_BUFFER_SIZE];
    

    我从字符串填充它:

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

    在jdb中,我想打印字节数组的内容。我试过了

    main[1] print decompressed
    

    返回:

     decompressed = instance of byte[7] (id=342)
    
    1 回复  |  直到 15 年前
        1
  •  3
  •   iokevins    15 年前

    dump decompressed
    

    这将转储字节值!:)