File bakFile = new File(javaFile.getAbsolutePath()+".bak");
FileOutputStream fos = new FileOutputStream(bakFile);
fos.write(DEFAULT_HEADER.getBytes());
FileChannel fc = raf.getChannel();
long count = raf.length() - endOfHeader;
fc.transferTo(endOfHeader, count, fos.getChannel());
fc.close();
fos.close();
raf.close();
if( javaFile.delete() == false )
log.severe("Failed to delete java file: "+javaFile);