code: public final byte[] serialize(Object object) throws IOException {
          if (object == null)
              return null;
  
          ByteArrayOutputStream bout = new ByteArrayOutputStream();
          SerializationService serializationSvc = serializationSvcRef.getServiceWithException();
          ObjectOutputStream oout = serializationSvc.createObjectOutputStream(new DeflaterOutputStream(bout));
          oout.writeObject(object);
          oout.flush();
          oout.close();
          byte[] bytes = bout.toByteArray();
          return bytes;
      }
docs: Utility method that serializes an object to bytes.
  
  @param object object to serialize.
  @return bytes representing the object. Null if the object is null.
  @throws IOException if an error occurs serializing the object.