Write an unsigned 8 bit integer.

@param int $value

@return \BrianFaust\Binary\Buffer\Writer\Buffer
325354
public function writeUInt8(int $value): self
    {
        $this->bytes .= Writer::bit8($value);

        return $this;
    }
592076
private function fixUtf8Encoding($value) {
        $encoding = mb_detect_encoding($value, null, true);
        if ($encoding!='ASCII' && $encoding!='UTF-8')
            $value = utf8_encode($value);
        return $value;
    }
926828
public function writeVInt($value)
    {
        settype($value, 'integer');
        while ($value > 0x7F) {
            $this->_fwrite(chr(($value & 0x7F)|0x80));
            $value >>= 7;
        }
        $this->_fwrite(chr($value));
    }
1108442
public function initFromInteger($value)
    {
        $this->a = ($value >> 24) & 0xFF;
        $this->r = ($value >> 16) & 0xFF;
        $this->g = ($value >> 8) & 0xFF;
        $this->b = $value & 0xFF;

        return $this;
    }
176928
public static function utf8($value)
    {
        if (is_string($value) && mb_detect_encoding($value, "UTF-8", TRUE) != "UTF-8") {
            return utf8_encode($value);
        } else {
            return $value;
        }
    }
815333
public function initFromInteger($value)
    {
        $a = ($value >> 24) & 0xFF;
        $r = ($value >> 16) & 0xFF;
        $g = ($value >> 8) & 0xFF;
        $b = $value & 0xFF;
        $a = $this->rgb2alpha($a);

        $this->setPixel($r, $g, $b, $a);
    }
1138142
public function writeInt($value)
    {
        // We do not need to check if file position points to the end of "file".
        // Only append operation is supported now

        settype($value, 'integer');
        $this->_data .= chr($value>>24 & 0xFF) .
                        chr($value>>16 & 0xFF) .
                        chr($value>>8  & 0xFF) .
                        chr($value     & 0xFF);

        $this->_position = strlen($this->_data);
    }
228701
public static function encode($value)
    {
        $value = gmp_init($value, 10);
        $octets = chr(gmp_strval(gmp_and($value, 0x7f), 10));

        $rightShift = function ($number, $positions) {
            return gmp_div($number, gmp_pow(2, $positions));
        };

        $value = $rightShift($value, 7);
        while (gmp_cmp($value, 0) > 0) {
            $octets .= chr(gmp_strval(gmp_or(0x80, gmp_and($value, 0x7f)), 10));
            $value = $rightShift($value, 7);
        }

        return strrev($octets);
    }
1311005
public function writeInt32(int $value): self
    {
        $this->bytes .= Writer::bit32($value);

        return $this;
    }
419704
public void write1Bit(int value) throws IOException {
        Debug.print(value);
        if (curBit == 8) {
            curBit = 0;
            writeCurByte();
        }
        curByte[curBit++] = value;
    }
394175
public static function format($value)
    {
        $value = (string) $value;
        $arguments = func_get_args();
        $digit = 64;

        if (isset($arguments[1]) && is_numeric($arguments[1])) {
            $digit = intval($arguments[1]);
        }
        $bn = Utils::toBn($value);
        $bnHex = $bn->toHex(true);
        $padded = mb_substr($bnHex, 0, 1);

        if ($padded !== 'f') {
            $padded = '0';
        }        
        return implode('', array_fill(0, $digit-mb_strlen($bnHex), $padded)) . $bnHex;
    }
1069849
public function writeLong($value)
    {
        // We do not need to check if file position points to the end of "file".
        // Only append operation is supported now

        /**
         * Check, that we work in 64-bit mode.
         * fseek() and ftell() use long for offset. Thus, largest index segment file size in 32bit mode is 2Gb
         */
        if (PHP_INT_SIZE > 4) {
            settype($value, 'integer');
            $this->_data .= chr($value>>56 & 0xFF) .
                            chr($value>>48 & 0xFF) .
                            chr($value>>40 & 0xFF) .
                            chr($value>>32 & 0xFF) .
                            chr($value>>24 & 0xFF) .
                            chr($value>>16 & 0xFF) .
                            chr($value>>8  & 0xFF) .
                            chr($value     & 0xFF);
        } else {
            $this->writeLong32Bit($value);
        }

        $this->_position = strlen($this->_data);
    }
1080327
public static function integer($value){

		$value = static::_nullValue($value);

		if($value !== null){

			$value = (int) $value;
		}

		return $value;
	}
92145
public void writeDouble(double value) {
		try {
			buffer.writeInt(8);
			buffer.writeDouble(value);
		} catch (Exception e) {
			throw new BinaryWriteFailedException(e);
		}
	}
125330
public function writeInt64(int $value): self
    {
        $this->bytes .= Writer::bit64($value);

        return $this;
    }
1218529
protected function toInteger($value)
    {
        $numberValue = $this->toNumber($value);
        if (is_numeric($numberValue) && (int) $numberValue == $numberValue) {
            return (int) $numberValue; // cast to number
        }

        return $value;
    }
1300754
public static function createFromBinaryString($value)
    {
        Assertion::string($value);
        $value = '0x'.bin2hex($value);

        return new self($value, 16);
    }