imageIO

I am creating a gfx file for my game. Basically, i just serialize my heirarchy into a file. The files save fine, but when I reopen them in my editor, only the first image in each collection is available, the rest are null. Here’s my serialization code:


      private void writeObject(ObjectOutputStream out) throws IOException {
            out.writeObject(name);
            out.writeObject(sequences);
            out.writeInt(images.length);
            
            for(int i = 0; i < images.length; i++) {
                  try {
                        ImageIO.write(images[i],"PNG",out);
                  } catch(IOException e) {
                        e.printStackTrace();
                  }
            }
      }
      
      private void readObject(ObjectInputStream in) throws IOException, 
                                                                                          ClassNotFoundException {
            name = (String)in.readObject();
            sequences = (ImageSequence[])in.readObject();
            images = new BufferedImage[in.readInt()];
            
            for(int i = 0; i < images.length; i++) {      
                  images[i] = ImageIO.read(in);
            }
      }      

I know that the images are getting saved because the size of the saved file is proportional to the number of images I used. Any insight would be very helpful!