Create message, containing meta and data in df-envelope format.

    @json_meta - metadata
    @data - binary data
    @data_type - data type code for binary data
    @version - version of machine header
    @return - message as bytearray
163391
def create_message(
        json_meta, data, data_type=0, version=b'\x00\x01@\x00'):
    
    __check_data(data)
    meta = __prepare_meta(json_meta)
    data = __compress(json_meta, data)
    header = __create_machine_header(
        json_meta, data, data_type, version)

    return header + meta + data
495730
def create_message(self, message_data, delivery_mode=None, priority=None,
                       content_type=None, content_encoding=None,
                       serializer=None):
        """"""

        delivery_mode = delivery_mode or self.delivery_mode

        # No content_type? Then we're serializing the data internally.
        if not content_type:
            serializer = serializer or self.serializer
            (content_type, content_encoding,
             message_data) = serialization.encode(message_data,
                                                  serializer=serializer)
        else:
            # If the programmer doesn't want us to serialize,
            # make sure content_encoding is set.
            if isinstance(message_data, unicode):
                if not content_encoding:
                    content_encoding = 'utf-8'
                message_data = message_data.encode(content_encoding)

            # If they passed in a string, we can't know anything
            # about it.  So assume it's binary data.
            elif not content_encoding:
                content_encoding = 'binary'

        return self.backend.prepare_message(message_data, delivery_mode,
                                            priority=priority,
                                            content_type=content_type,
                                            content_encoding=content_encoding)
1361449
protected function initMetadata() {
		if (! is_file($this->metadataPath)) {
			$this->metadata = [];
			
			return $this->metadata;
		}
		
		$metaRaw = file_get_contents($this->metadataPath);

		if ($metaRaw === false) {
			throw new Exceptions\MetadataError('Unable to read the metadata');
		}

		$meta = json_decode($metaRaw);

		if ($meta === null) {
			throw new Exceptions\MetadataError('Error in the metadata; Errorcode: ' . json_last_error());
		}

		$this->metadata = (array) $meta;

		return $this->metadata;
	}
180509
private static function create($basicMessage, $rpcCode, $metadata, array $decodedMetadata, $previous = null)
    {
        $rpcStatus = ApiStatus::statusFromRpcCode($rpcCode);
        $messageData = [
            'message' => $basicMessage,
            'code' => $rpcCode,
            'status' => $rpcStatus,
            'details' => $decodedMetadata
        ];

        $message = json_encode($messageData, JSON_PRETTY_PRINT);

        return new ApiException($message, $rpcCode, $rpcStatus, [
            'previous' => $previous,
            'metadata' => $metadata,
            'basicMessage' => $basicMessage,
        ]);
    }
211194
def _create_json(self):
        
        data_json = {
            "name": self.name,
            "description": self.description,
            "autoJoin": self.autoJoin,
            "realm": self.realm,
        }
        return data_json
543085
def meta(self):
        
        path = find_dataset_path(
            self.name, data_home=self.data_home, fname="meta.json", raises=False
        )
        if path is None:
            return None

        with open(path, 'r') as f:
            return json.load(f)
1272570
def save_metadata_json(self, filename: str, structure: JsonExportable) -> None:
        """"""
        if self.compress_json:
            filename += '.json.xz'
        else:
            filename += '.json'
        save_structure_to_file(structure, filename)
        if isinstance(structure, (Post, StoryItem)):
            # log 'json ' message when saving Post or StoryItem
            self.context.log('json', end=' ', flush=True)
621655
def as_json(options={})
      options = @options.merge(options)

      if options[:root]
        { options[:root].to_sym => serializable_hash }.merge(meta_hash).merge(data_hash)
      else
        serializable_hash
      end
    end
1084645
def as_json
      # Build the payload's exception event
      payload_event = {
        app: {
          version: app_version,
          releaseStage: release_stage,
          type: app_type
        },
        context: context,
        device: {
          hostname: hostname
        },
        exceptions: exceptions,
        groupingHash: grouping_hash,
        session: session,
        severity: severity,
        severityReason: severity_reason,
        unhandled: @unhandled,
        user: user
      }

      # cleanup character encodings
      payload_event = Bugsnag::Cleaner.clean_object_encoding(payload_event)

      # filter out sensitive values in (and cleanup encodings) metaData
      filter_cleaner = Bugsnag::Cleaner.new(configuration.meta_data_filters)
      payload_event[:metaData] = filter_cleaner.clean_object(meta_data)
      payload_event[:breadcrumbs] = breadcrumbs.map do |breadcrumb|
        breadcrumb_hash = breadcrumb.to_h
        breadcrumb_hash[:metaData] = filter_cleaner.clean_object(breadcrumb_hash[:metaData])
        breadcrumb_hash
      end

      payload_event.reject! {|k,v| v.nil? }

      # return the payload hash
      {
        :apiKey => api_key,
        :notifier => {
          :name => NOTIFIER_NAME,
          :version => NOTIFIER_VERSION,
          :url => NOTIFIER_URL
        },
        :events => [payload_event]
      }
    end
976612
public static <T> Meta<T> meta() {
    return new Meta<>(MetaConfig.defaultConfig(), null, TYPED_PROPERTY_ARRAYS.empty(), TYPED_STRING_ARRAYS.empty());
  }
209272
public static BaseMessage createMessage(String strMessageClassName, BaseMessageHeader messageHeader, Object data)
    {
       BaseMessage message = null;
       
       if ((strMessageClassName == null)
           && (messageHeader != null))
       {
           strMessageClassName = (String)messageHeader.get(BaseMessageHeader.INTERNAL_MESSAGE_CLASS);
           if ((strMessageClassName == null) || (strMessageClassName.length() == 0))
           {
//?               String strRequestType = (String)messageHeader.get(TrxMessageHeader.MESSAGE_REQUEST_TYPE);
//?               if ((strRequestType == null) || (strRequestType.length() == 0) || (RequestType.MANUAL.equalsIgnoreCase(strRequestType)))
//?                   strMessageClass = ManualMessage.class.getName();
           }
       }
       if ((strMessageClassName != null) && (strMessageClassName.length() > 0))
       {
           strMessageClassName = ClassServiceUtility.getFullClassName(strMessageClassName);
           Object obj = ClassServiceUtility.getClassService().makeObjectFromClassName(strMessageClassName);
           if (obj instanceof BaseMessage)
           {
               message = (BaseMessage)obj;
               message.init(messageHeader, null);
           }
           else if  (obj instanceof MessageRecordDesc)
           {
               message = new TreeMessage(messageHeader, null);
               ((MessageRecordDesc)obj).init(message, null);
           }
       }
       return message;
   }
739002
def create
      upload_meta = prepare_to_upload
      response = upload_to_aws_s3(upload_meta)
      notify_ribose_file_upload_endpoint(response, upload_meta.fields.key)
    end
736597
def to_json(msg):
    
    result = {}
    
    # herald specification version
    #result[herald.MESSAGE_HERALD_VERSION] = herald.HERALD_SPECIFICATION_VERSION
    
    # headers
    result[herald.MESSAGE_HEADERS] = {}        
    if msg.headers is not None:
        for key in msg.headers:
            result[herald.MESSAGE_HEADERS][key] = msg.headers.get(key) or None        
    
    # subject
    result[herald.MESSAGE_SUBJECT] = msg.subject
    # content
    if msg.content is not None:
        if isinstance(msg.content, str):
            # string content
            result[herald.MESSAGE_CONTENT] = msg.content
        else:
            # jaborb content
            result[herald.MESSAGE_CONTENT] = jabsorb.to_jabsorb(msg.content)
    
    # metadata
    result[herald.MESSAGE_METADATA] = {}        
    if msg.metadata is not None:
        for key in msg.metadata:
            result[herald.MESSAGE_METADATA][key] = msg.metadata.get(key) or None
            
    return json.dumps(result, default=herald.utils.json_converter)
321286
def create(self, data):
        
        data = values.of({'Data': serialize.object(data), })

        payload = self._version.create(
            'POST',
            self._uri,
            data=data,
        )

        return StreamMessageInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            stream_sid=self._solution['stream_sid'],
        )
508139
def _create_json(self):
        
        data_json = {
            "rclass": "virtual",
            "key": self.name,
            "description": self.description,
            "packageType": self.packageType,
            "repositories": self._repositories,
            "notes": self.notes,
        }

        return data_json
173455
def build_metadata(metadata = {})
      unless opts[:password].empty?
        username = opts.fetch(:username, 'grpc').to_s
        username = username.empty? ? '' : "#{username}:"
        auth_string = Base64.encode64("#{username}#{opts[:password]}")
        metadata[:authorization] = "Basic #{auth_string}".tr("\n", '')
      end
      metadata
    end
1258358
public byte[] toBinary(Object value, Object meta, boolean insertMeta) {
		return toBinary(value, meta, insertMeta, (input) -> {
			return mapper.writeValueAsBytes(input);
		}