docs: public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException {
          try {
              while (true) {
                  try {
                      Object obj = ois.readObject();
                      // we allow null objects in the object stream
                      closure.call(obj);
                  } catch (EOFException e) {
                      break;
                  }
              }
              InputStream temp = ois;
              ois = null;
              temp.close();
          } finally {
              closeWithWarning(ois);
          }
      }