code: private void restoreAttributes(InputStream is, int size, SessionData data) throws Exception {
          if (size > 0) {
              // input stream should not be closed here
              Map<String, Object> attributes = new HashMap<>();
              ObjectInputStream ois =  new CustomObjectInputStream(is);
              for (int i = 0; i < size; i++) {
                  String key = ois.readUTF();
                  Object value = ois.readObject();
                  attributes.put(key, value);
              }
              data.putAllAttributes(attributes);
          }
      }
docs: Load attributes from an input stream that contains session data.
  
  @param is the input stream containing session data
  @param size number of attributes
  @param data the data to restore to
  @throws Exception if the input stream is invalid or fails to read