code: public static void streamOut(OutputStream out, Object object, boolean compressed) throws IOException {
          if (compressed) {
              out = new GZIPOutputStream(out);
          }
          DroolsObjectOutputStream doos = null;
          try {
              doos = new DroolsObjectOutputStream(out);
              doos.writeObject(object);
          } finally {
              if( doos != null ) {
                  doos.close();
              }
              if (compressed) {
                  out.close();
              }
          }
      }
docs: This method would stream out the given object to the given output stream uncompressed or compressed
  depending on the given flag.  The output contents could only be read by the corresponding "streamIn"
  methods of this class.
  @param out
  @param object
  @throws IOException