im developing a program in which I need to make a save file that contains a serialized object with all the settings and some images that the user added to the program, i tried adding the images as imageicons to the object so they would get serialized with it but it turned out to be very inefficient regarding size, then, i tried serializing the object through a objectoutputstream and then in the same file serializing the image with imageoutputstream, but when i deserialize the image it is corrupt, the object does deserialize correctly tho, so how can i make a save file that contains a serialized object and some resourses in the same file?? (like a project save file) thanks in advance
Share
You can implement some class which handles packaging system. Firstly serializing the Object with ObjectOutputStream and then save the resource next to it (can be in some folder when theres more resources) and pack it into ZIP archive (Java got API for this). The extension can be something else than “.zip”…Microsoft docx format or OpenOffice odt format is also a ZIP archive which contains many XML files… 🙂