How to write bytes from heapdump into file in VisualVM?
Well, one possibility is use this OQL:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To get Id of object | |
//In VisualVM right click on instance of byte[] and select 'Copy ID' | |
var bytes = heap.findObject(0xe21b95d8); | |
var filePath = "c:/tmp/result.txt" | |
var fos = new java.io.FileOutputStream(filePath); | |
var len = bytes.length | |
for (var i=0; i<len; i++) { | |
fos.write(bytes[i]); | |
} | |
fos.close(); | |
"Bytes has been written into file '" + filePath+"'"; |