I am writing a Java code where i have the user id with me which will be needed in the EXE file. So for this I am thinking of appending the user id at the end of the EXE file. The code i have written is as
public void appendUser()
throws Exception {
Files.copy("/tmp/generic/myFile.exe", "/tmp/myFile.exe");
BufferedWriter fileWriter = new BufferedWriter(
new FileWriter(destination.getFileName().toString()));
fileWriter.append("MrX@google.com");
file = new File(destination.getFileName().toString());
}
But this will modify the generic copy of the EXE.
I can copy the file at the temp location first and then append the userId on that file and return it. But i want to know if there is any other smart way where i dont have the create the separate copy of the file first .