function write($content, $inByte = null)
    {
        $this->_assertWritable();

        $stream = $this->resource()->getRHandler();

        $inByte = ($inByte === null)
            ? $this->getBuffer()
            : $inByte;


        $content = (string) $content;
        if (null === $inByte)
            $ret = fwrite($stream, $content);
        else
            $ret = fwrite($stream, $content, $inByte);

        if (false === $ret)
            throw new \RuntimeException('Cannot write on stream.');

        $transCount = $inByte;
        if ($transCount === null) {
            if (function_exists('mb_strlen'))
                $transCount = mb_strlen($content, '8bit');
            else
                $transCount = strlen($content);
        }

        $this->_resetTransCount($transCount);
        return $this;
    }