! @brief Write bytes into the connection.
12097
def write(self, data):
        """"""
        # If nobody is connected, act like all data was written anyway.
        if self.connected is None:
            return 0
        data = to_bytes_safe(data)
        size = len(data)
        remaining = size
        while remaining:
            count = self._abstract_socket.write(data)
            remaining -= count
            if remaining:
                data = data[count:]
        return size
910307
async def write_bytes(self, writer: AbstractStreamWriter,
                          conn: 'Connection') -> None:
        """"""
        # 100 response
        if self._continue is not None:
            await writer.drain()
            await self._continue

        protocol = conn.protocol
        assert protocol is not None
        try:
            if isinstance(self.body, payload.Payload):
                await self.body.write(writer)
            else:
                if isinstance(self.body, (bytes, bytearray)):
                    self.body = (self.body,)  # type: ignore

                for chunk in self.body:
                    await writer.write(chunk)  # type: ignore

            await writer.write_eof()
        except OSError as exc:
            new_exc = ClientOSError(
                exc.errno,
                'Can not write request body for %s' % self.url)
            new_exc.__context__ = exc
            new_exc.__cause__ = exc
            protocol.set_exception(new_exc)
        except asyncio.CancelledError as exc:
            if not conn.closed:
                protocol.set_exception(exc)
        except Exception as exc:
            protocol.set_exception(exc)
        finally:
            self._writer = None
139008
@Override
    public void write(int oneByte) {
        if (count == buf.length) {
            expand(1);
        }
        buf[count++] = (byte) oneByte;
    }
471137
public void writeBytes(byte[] buffer)
        throws IOException
    {
        if (buffer == null)
            os.write('N');
        else
            writeBytes(buffer, 0, buffer.length);
    }
377178
protected function write($buffer)
    {
        $socket = $this->getResource();

        while (($length = strlen($buffer)) > 0) {
            $written = @fwrite($socket, $buffer);

            if ($length === $written) {
                return;
            }

            if ($written === false || $written === 0) {
                $this->onConnectionError('Error while writing bytes to the server.');
            }

            $buffer = substr($buffer, $written);
        }
    }
220334
def writeByte(self, byte):
        
        self.data.write(pack("B" if not self.signed else "b", byte))
868668
final int writeBytes(byte[] buffer, long bytesToWrite) throws IOException {
        if (commPort != null && commPort.isOpen()) {
            return commPort.writeBytes(buffer, bytesToWrite);
        }
        else {
            throw new IOException("Comm port is not valid or not open");
        }
    }
108000
def write_bytes(self, data):
        
        if not isinstance(data, six.binary_type):
            raise TypeError(
                'data must be %s, not %s' %
                (six.binary_type.__class__.__name__, data.__class__.__name__))
        with self.open(mode='wb') as f:
            return f.write(data)
1211334
def _write_bytes(self, data):
        
        with self.__lock:
            self.output.write(to_bytes(data, self.encoding))
186959
@Override
    public void write(byte[] b, int off, int len) throws IOException
    {
        int wbytes = len;
        int offset = off;
        
        while( wbytes > 0 )
        {
            if ( buf.position() >= buf.capacity() )
            {
                flush();
            }
            
            int length = Math.min( wbytes, buf.limit() - buf.position() );
            
            buf.put(b, offset, length);
            
            offset += length;
            wbytes -= length;
        }
    }
491104
def write(self, data):
        """"""

        report_size = self.packet_size
        if self.ep_out:
            report_size = self.ep_out.wMaxPacketSize

        for _ in range(report_size - len(data)):
            data.append(0)

        self.read_sem.release()

        self.ep_out.write(data)
998784
def write (self, s):
        
        if isinstance(s, bytes):
            s = self._decode(s)
        for c in s:
            self.process(c)
836439
private function bytes_to_file($bytes, $output_file) {
        $ifp = fopen($output_file, "wb");
        fwrite($ifp, $bytes);
        fclose($ifp);
    }
417727
async def write(self, data):
        
        if type(data) != bytes:
            data = self._encode_body(data)

        self.protocol.push_data(b"%x\r\n%b\r\n" % (len(data), data))
        await self.protocol.drain()
21151
private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb)
        throws IOException
    {
        while (bb.remaining() > 0) {
            int n = ch.write(bb);
            if (n <= 0)
                throw new RuntimeException("no bytes written");
        }
    }
77740
def write_chunk(cls, sock, chunk_type, payload=b''):
    """"""
    chunk = cls.construct_chunk(chunk_type, payload)
    sock.sendall(chunk)
114219
void send(byte streamCode, byte[] b, int offset, int len) throws IOException {
    synchronized (writeLock) {
      out.writeInt(len);
      out.writeByte(streamCode);
      out.write(b, offset, len);
    }
    out.flush();
  }