Skip to content

Instantly share code, notes, and snippets.

@philipparndt
Last active November 26, 2019 08:18
Show Gist options
  • Save philipparndt/bec7d30d592a50ba6e6d00fb95785285 to your computer and use it in GitHub Desktop.
Save philipparndt/bec7d30d592a50ba6e6d00fb95785285 to your computer and use it in GitHub Desktop.

You can export a byte array from JProfiler Heap Walker using the following script.

Export byte array

File tempFile = File.createTempFile("jprofiler-export-", "");
try (OutputStream out = new FileOutputStream(tempFile)) {
    out.write(byteArray);
    out.flush();
}
return tempFile.getPath();

Export char array

File tempFile = File.createTempFile("jprofiler-export-", "");

try (FileWriter writer = new FileWriter(tempFile)) {
    writer.write(charArray);
    writer.flush();
}
return tempFile.getPath();
  • Open the Heap Walker, select References and open the context menu of the byte array.
  • Select Run Script On Selected Instance to edit and execute the script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment