@inheritdoc

@param string $buf
@throws TTransportException
976193
public function write($buf)
    {
        $this->wBuf_ .= $buf;
        if (TStringFuncFactory::create()->strlen($this->wBuf_) >= $this->wBufSize_) {
            $out = $this->wBuf_;

            // Note that we clear the internal wBuf_ prior to the underlying write
            // to ensure we're in a sane state (i.e. internal buffer cleaned)
            // if the underlying write throws up an exception
            $this->wBuf_ = '';
            $this->transport_->write($out);
        }
    }
549215
public static function serializeTransaction($chainName, $trxParams, $byteBuffer = null)
    {
        $buffer = $byteBuffer === null ? (new ByteBuffer()) : $byteBuffer;

        $buffer->writeInt16LE($trxParams[0]['ref_block_num'], 0);
        $buffer->writeInt32LE($trxParams[0]['ref_block_prefix'], 2);
        $expirationSec = is_int($trxParams[0]['expiration']) ? $trxParams[0]['expiration'] : strtotime($trxParams[0]['expiration']);
        $buffer->writeInt32LE($expirationSec, 6);
        $buffer->writeInt8(count($trxParams[0]['operations']));


        //serialize only operations data
        foreach ($trxParams[0]['operations'] as $operation) {
            $opData = $operation[1];
            self::serializeOperation($chainName, $operation[0], $opData, $buffer);
        }


        $buffer->writeInt8(count($trxParams[0]['extensions']));
        foreach ($trxParams[0]['extensions'] as $extansion) {
            //is it used anywhere?
        }

        return $byteBuffer === null ? $buffer->getBuffer('H', 0, $buffer->getCurrentOffset()) : $byteBuffer;
    }
349797
public void write(char[] buf) throws IOException {
	    if (writer != null) {
	        writer.write(buf);
	    } else {
	        write(buf, 0, buf.length);
	    }
    }
82777
protected function createTransportForType($transportType, array $parameters) {
        if ($transportType === 'null') {
            return $this->createNullTransport($parameters);
        } else if ($transportType === 'sendmail') {
            return $this->createSendmailTransport($parameters);
        } else if ($transportType === 'smtp') {
            return $this->createSmtpTransport($parameters);
        }

        throw new MailerTransportTypeIsNotSupported(s(
            'Transport type "%s" is not supported.',
            $transportType
        ));
    }
391878
@Override
    public void write(byte[] buf, int off, int len)
    {
        write(new String(buf, off, len));
    }
815397
function (buf) {
    if (!(buf instanceof Buffer) || buf.length !== Id.SIZE)
        throw new Error('invalid buffer');
    this._buf = buf;
}
580135
public static final int move(byte[] buf, int offset, int length, ByteBuffer bb)
    {
        int count = Math.min(length, bb.remaining());
        bb.put(buf, offset, count);
        return count;
    }
776022
@Override
    public TTransport connect(TTransport transport, String serverHost, String asUser) throws TTransportException {
        int maxBufferSize = type.getMaxBufferSize(storm_conf);
        // create a framed transport
        TTransport conn = new TFramedTransport(transport, maxBufferSize);

        // connect
        conn.open();
        LOG.debug("Simple client transport has been established");

        return conn;
    }
224388
public static function decodeUnsigned(string $buf, int &$x): int
    {
        $x = 0;
        $s = 0;
        for ($i = 0; $i < strlen($buf); $i++) {
            $b = ord($buf[$i]);
            if ($b < 0x80) {
                if ($i > 9 || $i == 9 && $b > 1) {
                    // overflow
                    $x = 0;
                    return -($i + 1);
                }
                $x = $x | $b << $s;
                return $i + 1;
            }
            $x |= ($b & 0x7f) << $s;
            $s += 7;
        }
        $x = 0;
        return 0;
    }
661388
public static function executeStmt($stmt, $types, $inserts) {
        self::init();
        try {
            if(!$stmt) {
                throw new DbException('Statement not established');
            } elseif(!$stmt->bind_param($types, ...$inserts)) {
                throw new DbException('Binding error');
            }
            $stmt->execute();
        } catch(DbException $e) {
            self::$_ops->formatError($inserts, $e->getMessage());
        } finally {
            return self::evaluateQuery($stmt);
        }

    }
25504
public function readFromBuffer(\EventBuffer $buf)
    {
        if (!$this->req) {
            return false;
        }
        $n = min($this->req->attrs->contentLength - $this->readed, $buf->length);
        if ($n > 0) {
            $m = $this->appendFrom($buf, $n);
            $this->readed += $m;
            if ($m > 0) {
                $this->onRead();
            }
        } else {
            $this->onRead();
            return 0;
        }
        return $m;
    }
423675
public static function encodeSigned(string &$buf, int $x): int
    {
        $ux = $x << 1;
        if ($x < 0) {
            $ux = ~$ux;
        }
        return self::encodeUnsigned($buf, $ux);
    }
410331
public function send(TransportRequestInterface $request)
    {
        try {
            return new GuzzleTransportResponse($this->guzzleClient->send($request->getWrappedRequest()));
        } catch (\Exception $exception) {
            throw new TransportLayerException($exception->getMessage(), $exception->getCode(), $exception);
        }
    }
1345127
def write(self, buf):
        """"""
        return self.transport_sock.sendto(
            buf,
            (self.transport_host, self.transport_port)
        )
887183
public static function writeJSON($obj, $buf = null)
    {
        $output = json_encode($obj);

        if ($output === false && json_last_error() === JSON_ERROR_UTF8)
        {
            $obj_fixed = Encoding::fixUTF8($obj);
            $output = json_encode($obj_fixed);
            if ($output === false && json_last_error() === JSON_ERROR_UTF8)
            {
                // @codeCoverageIgnoreStart
                // The input has to be extremely weird to trigger this, so
                // in practice it shouldn't happen.  
                $rep = WF::str($obj); 
                throw new IOException("Invalid encoding: " . $rep); 
                // @codeCoverageIgnoreEnd
            }
        }

        if (is_resource($buf))
        {
            fwrite($buf, $output);
            return "";
        }

        return $output;
    }
1344915
public function addWriteData($buf)
    {
        if ($this->outBuf === null) {
            $this->outBuf = $buf;
        } else {
            $this->outBuf .= $buf;
        }
    }
500630
public void write(ByteArrayBuffer buf) {
        data.copy(buf.data, 0, pointer, buf.length());
        pointer += buf.length();
    }