public static Object[] readAll(InputStream stream) throws Exception {
  ObjectInputStream ois;
  Vector<Object> result;
  if (!(stream instanceof BufferedInputStream)) {
    stream=new BufferedInputStream(stream);
  }
  ois=new ObjectInputStream(stream);
  result=new Vector<Object>();
  try {
    while (true) {
      result.add(ois.readObject());
    }
  }
 catch (  IOException e) {
  }
  ois.close();
  return result.toArray(new Object[result.size()]);
}

public static Object [ ] readAll ( InputStream stream ) throws Exception { ObjectInputStream ois ; Vector < Object > result ; if ( ! ( stream instanceof BufferedInputStream ) ) { stream = new BufferedInputStream ( stream ) ; } ois = new ObjectInputStream ( stream ) ; result = new Vector < Object > ( ) ; try { while ( true ) { result . add ( ois . readObject ( ) ) ; } } catch ( IOException e ) { } ois . close ( ) ; return result . toArray ( new Object [ result . size ( ) ] ) ; }
deserializes from the given stream and returns the object from it .
