Hello everybody,
For a school assignment I need to save images to .ser files. Could someone explain me how i get it succesfull. The program itself creates a .ser but the content is useless (’ NUL ENQ). Thanks in advance :). This is the method i came up with:
public void savePhoto() {
try { // Write to disk with FileOutputStream
FileOutputStream fOut = new FileOutputStream(photoDir);
// Write object with ObjectOutputStream
ObjectOutputStream objOut = new ObjectOutputStream(fOut);
//locaties is the array which holds the images
for(int x = 0; x < locaties.size(); x++) {
//I don't know what Serialize has to be an array and if so what kind?
Serialize[x].writeImageObject(objOut);
}
System.out.println("File Saved!");
} catch (FileNotFoundException e) {
System.out.println("Error : Cannot save file.");
e.printStackTrace();
} catch (IOException e) {
System.out.println("Error : Cannot write file.");
e.printStackTrace();
}
}