I have the contents of a zip file that I received from a clients multipart form data api stored as a String.
I simply want to save this data now as a zip file; however, when I try saving to a file as below then when I attempt to open the file I get a message stating
"Windows cannot open the folder. The compressed (zipped) Folder 'C:\payload.zip' is invalid."
public void createFile(String data) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter("c:\\payload.zip"));
out.write(data);
out.close();
}
catch (IOException e)
{
System.out.println("Exception ");
}
}
I am simply passing the String that I receive to the little test createFile method shown above.
I thought that I would paste the actual String contents below but when I attempt to do so it converts it to this (Without the double quotes): " PK"
Any help with what I am doing wrong?