public static byte[] computeCallDiagram(final String className,
final URLClassLoader classLoader) throws IOException,
ClassNotFoundException, InterruptedException {
byte[] tempFileBytes;
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);
}