Write mesage to tansport.  msg should be a member of a valid `protobuf class <https://developers.google.com/protocol-buffers/docs/pythontutorial>`_ with a SerializeToString() method.
431
def write(self, msg):
        
        ser = msg.SerializeToString()
        header = struct.pack(">HL", mapping.get_type(msg), len(ser))
        self._write(b"##" + header + ser, msg)
951779
async def message(self, msg, msg_type=None):
        
        elem_type = msg_type if msg_type is not None else msg.__class__

        if hasattr(elem_type, 'blob_serialize'):
            msg = elem_type() if msg is None else msg
            return await msg.blob_serialize(self)

        fields = elem_type.f_specs()
        for field in fields:
            await self.message_field(msg=msg, field=field)

        return msg
1190451
async def dump_message(self, msg, msg_type=None):
        
        mtype = msg.__class__ if msg_type is None else msg_type
        fields = mtype.f_specs()
        for field in fields:
            await self.message_field(msg=msg, field=field)
668737
def write(self, buffer):
        
        if type(buffer) == type(0):
            buffer = chr(buffer)
        elif not isinstance(buffer, bytes):
            buffer = buffer.encode(self.encoding)
        if IAC in buffer:
            buffer = buffer.replace(IAC, IAC+IAC)
        self.msg("send %s", repr(buffer))
        self.sock.send(buffer)
1196436
public static <T> int writeTo(LinkedBuffer buffer, T message, Schema<T> schema)
    {
        if (buffer.start != buffer.offset)
            throw new IllegalArgumentException("Buffer previously used and had not been reset.");

        final ProtobufOutput output = new ProtobufOutput(buffer);
        try
        {
            schema.writeTo(output, message);
        }
        catch (IOException e)
        {
            throw new RuntimeException("Serializing to a LinkedBuffer threw an IOException " +
                    "(should never happen).", e);
        }

        return output.getSize();
    }
1103160
def write(self, text, fg='black', bg='white'):
        ''''''
        if isinstance(text, str):
            sys.stdout.write(text)
        else:
            sys.stdout.write(str(text))
        sys.stdout.flush()
109089
def writeHeader(self, msg):
		

		header = bytearray([self.protocol_version]) #protocol version 1.0
		header.extend(struct.pack('<H', len(msg)))

		msg = header + msg

		return msg
1089790
async def message(self, msg, msg_type=None, use_version=None):
        
        elem_type = msg_type if msg_type is not None else msg.__class__
        msg = elem_type() if msg is None else msg
        if hasattr(elem_type, "serialize_archive"):
            version = await self.version(elem_type, None, elem=msg) if use_version is None else use_version
            return await msg.serialize_archive(self, version=version)

        mtype = msg.__class__ if msg_type is None else msg_type
        fields = mtype.f_specs()
        if hasattr(mtype, "serialize_archive"):
            raise ValueError("Cannot directly load, has to use archive with %s" % mtype)

        await self.message_fields(msg, fields)
        return msg
247369
def write(self, arg):
        
        if isinstance(arg, str):
            arg = arg.encode(self.encoding)
        return self._buffer.write(arg)
1322921
def write(val, raw: false)
      val= _serialize_value(val, raw: raw)
      @dbus_obj[I_GATT_CHARACTERISTIC].WriteValue(val, [])
    end
1225597
def create(rawmessage):
    """"""
    rawmessage = _trim_buffer_garbage(rawmessage)

    if len(rawmessage) < 2:
        return (None, rawmessage)

    code = rawmessage[1]
    msgclass = _get_msg_class(code)

    msg = None

    remaining_data = rawmessage
    if msgclass is None:
        _LOGGER.debug('Did not find message class 0x%02x', rawmessage[1])
        rawmessage = rawmessage[1:]
        rawmessage = _trim_buffer_garbage(rawmessage, False)
        if rawmessage:
            _LOGGER.debug('Create: %s', create)
            _LOGGER.debug('rawmessage: %s', binascii.hexlify(rawmessage))
            msg, remaining_data = create(rawmessage)
        else:
            remaining_data = rawmessage
    else:
        if iscomplete(rawmessage):
            msg = msgclass.from_raw_message(rawmessage)
            if msg:
                remaining_data = rawmessage[len(msg.bytes):]
    # _LOGGER.debug("Returning msg: %s", msg)
    # _LOGGER.debug('Returning buffer: %s', binascii.hexlify(remaining_data))
    return (msg, remaining_data)
241805
def write(self, buf):
        """"""
        if not isinstance(buf, six.binary_type):
            raise TypeError('buf: must be a bytes instance')
        # Be careful not to write zero-length chunks as they indicate the end of a body.
        if len(buf) == 0:
            return
        if self._content_length and self._bytes_written > self._content_length:
            raise RuntimeError('wrote too many bytes ({} > {})'
                                    .format(self._bytes_written, self._content_length))
        self._bytes_written += len(buf)
        if self._chunked:
            buf = create_chunk(buf)
        self._protocol.writer.write(buf)
1328706
private ByteBuf writeError(ByteBuf buffer, Throwable t, ThreadContext context) {
    context.serializer().writeObject(t, OUTPUT.get().setByteBuf(buffer));
    return buffer;
  }
874895
def serialize(self, outbuffer):
		
		outbuffer.add_net32int(self.protocol_version)
		outbuffer.add_net32int(self.header_size)
1296176
def write(self, text, fg='black', bg='white'):
        ''''''
        try:
            self.parent_pipe_send.send(Text(text, fg, bg))
        except Exception:
            pass
942804
private ByteBuf writeResponse(ByteBuf buffer, Object request, ThreadContext context) {
    context.serializer().writeObject(request, OUTPUT.get().setByteBuf(buffer));
    return buffer;
  }
53283
def __send_buffer(self):
        
        bytes_written = self.serial.write(self.__out_buffer.raw)
        if self.DEBUG_MODE:
            print("Wrote: '{}'".format(binascii.hexlify(self.__out_buffer.raw)))
        if bytes_written != len(self.__out_buffer):
            raise IOError("{} bytes written for output buffer of size {}".format(bytes_written,
                                                                                 len(self.__out_buffer)))
        return bytes_written