code: public static byte[] streamOut(Object object, boolean compressed) throws IOException {
          ByteArrayOutputStream bytes = new ByteArrayOutputStream();
  
          streamOut(bytes, object, compressed);
          bytes.flush();
          bytes.close();
          return bytes.toByteArray();
      }
docs: This routine would stream out the give object, uncompressed or compressed depending on the given flag,
  and store the streamed contents in the return byte array. The output contents could only be read by
  the corresponding "streamIn" method of this class.
  @param object
  @param compressed
  @return
  @throws IOException