MethodInvocationDiagramGenerator methodInvocationGen = new MethodInvocationDiagramGenerator(
classLoader, className);
// Save it in a temporary file.
File tempFile = File.createTempFile("tmp", ".png");
try {
methodInvocationGen.generate(tempFile);
tempFileBytes = FileUtils.loadFile(tempFile);
} finally {
if (tempFile != null && tempFile.exists()) {
FileUtils.deleteFile(tempFile);
}