čtvrtek 4. září 2014

VisualVM - OQL which write byte[] into file

How to write bytes from heapdump into file in VisualVM?

Well, one possibility is use this OQL:

//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+"'";
view raw gistfile1.txt hosted with ❤ by GitHub