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("[email protected]");
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 .
question from:
https://stackoverflow.com/questions/65893562/how-to-write-a-string-at-the-end-of-the-exe-file-in-java 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…