Skip to content

Instantly share code, notes, and snippets.

@bugs84
Created September 3, 2014 14:54
Show Gist options
  • Save bugs84/514cd38ccd480305de1a to your computer and use it in GitHub Desktop.
Save bugs84/514cd38ccd480305de1a to your computer and use it in GitHub Desktop.
OQL how to write bytes in heapdump into file in VisualVM
//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+"'";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment