I have a collection of buffered images that I want to serialize and then deserialize. For example I have an arrayList full of buffered images which are iterated through and written to a ObjectOutputStream
for (BufferedImages i : images{
ImageIO.write(i,"png",ImageIO.createImageOutputStream(output));
}
When I go to re-serialize the images, I tried to use
BufferedImage image =ImageIO.read(ImageIO.createImageInputStream(input));
but it only reads in one image.
Whats the correct way to re-serialize a collection of buffered images stored within the same serialized file?
Also once the images have been re-serialized they get redrawn to a JLabel, How do I know which image is the correct one for each JLabel?