title: how to convert an input stream to a java object
body: <pre><code>ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(baos);
  oos.writeObject(reg_be);
  oos.flush();
  oos.close();
  
  InputStream is = new ByteArrayInputStream(baos.toByteArray());
  </code></pre>
  
  <p>This code convert Java <code>Object</code> to <code>InputStream</code> and how can I convert <code>InputStream</code> to an <code>Object</code>?  I need to convert my <code>Object</code> to an <code>InputStream</code> then I pass it and I want to get my <code>Object</code> back.</p>