code: public byte[] toStream(final Object iObject) throws IOException {
  		if (iObject == null)
  			return null;
  
  		if (!(iObject instanceof OSerializableStream))
  			throw new OSerializationException("Cannot serialize the object [" + iObject.getClass() + ":" + iObject
  					+ "] since it does not implement the OSerializableStream interface");
  
  		OSerializableStream stream = (OSerializableStream) iObject;
  
  		// SERIALIZE THE CLASS NAME
  		final byte[] className;
  		if (iObject instanceof OCommandSQL)
  			className = SQL_COMMAND_CLASS_ASBYTES;
  		else if (iObject instanceof OCommandScript)
  			className = SCRIPT_COMMAND_CLASS_ASBYTES;
  		else
  			className = OBinaryProtocol.string2bytes(iObject.getClass().getName());
  
  		// SERIALIZE THE OBJECT CONTENT
  		byte[] objectContent = stream.toStream();
  
  		byte[] result = new byte[4 + className.length + objectContent.length];
  
  		// COPY THE CLASS NAME SIZE + CLASS NAME + OBJECT CONTENT
  		System.arraycopy(OBinaryProtocol.int2bytes(className.length), 0, result, 0, 4);
  		System.arraycopy(className, 0, result, 4, className.length);
  		System.arraycopy(objectContent, 0, result, 4 + className.length, objectContent.length);
  
  		return result;
  	}
docs: Serialize the class name size + class name + object content