code: @SuppressWarnings("unchecked")
      public static <T> T load(InputStream stream) {
          try {            
              ObjectInputStream inStream = (stream instanceof ObjectInputStream)
                  ? (ObjectInputStream)stream
                  : new ObjectInputStream(stream);
              T object = (T) inStream.readObject();
              return object;
          } catch (IOException ioe) {
              throw new IOError(ioe);
          } catch (ClassNotFoundException cnfe) {
              throw new IOError(cnfe);
          }
      }
docs: Loads a serialized object of the specifed type from the stream.  This
  method does not close the stream after reading
  
  @param file the file from which a mapping should be loaded
  @param type the type of the object being deserialized
  
  @return the object that was serialized in the file