Read the value of an input/output pin.

@param int $pin The BCM pin number
@return int The current value of the pin.
513024
public function read(int $pin): int
    {
        if (!isset($this->storage[$pin])) {
            return 0;
        }
        return $this->storage[$pin];
    }
675018
private function read()
    {
        $s = null;

        for (; !feof($this->sock);) {
            if (($line = fgets($this->sock, 1e3)) == null) {
                continue;
            }

            $s = explode(' ', $line)[0];

            if (preg_match('#^[0-9]+$#', $s)) {
                break;
            }
        }

        return (int) $s;
    }
458238
void pin() {
		while (true) {
			int refCnt = pendingReferences.get();

			if (refCnt >= 0) {
				if (pendingReferences.compareAndSet(refCnt, refCnt + subpartitions.length)) {
					break;
				}
			}
			else {
				throw new IllegalStateException("Released.");
			}
		}
	}
1234393
public function readBitStream($bits)
    {
        $this->readByteIfNeeded();

        $result = '';
        for ($i = 0; $i < $bits; $i++) {
            $mask = pow(2, $this->currentBitPosition);
            $result = ((($this->currentByte & $mask) === $mask) ? '1' : '0').$result;

            $this->currentBitPosition++;
            if (($i + 1) < $bits) {
                $this->readByteIfNeeded();
            }
        }

        return $result;
    }
532898
public function getByteValue() : int
    {
        $bits = (array)$this->getValue();
        return array_reduce($bits, function ($carry, $item) {
            return $carry | (int)$item;
        }, 0);

    }
162401
public function readInt16($offset = 0)
    {
        $s = $this->read(2, $offset);
        list(, $ret) = unpack("s", self::$isLittleEndian ? self::swapEndian16($s) : $s);
        return $ret;
    }
281709
public function readBytes($num)
    {
        $returnValue = substr($this->_data, $this->_position, $num);
        $this->_position += $num;

        return $returnValue;
    }
963662
private void read(final DataInput pInput) throws IOException {
        byte[] bytes = new byte[64];
        pInput.readFully(bytes);

        // NOTE: Length is in bytes, including the null-terminator...
        int nameLength = pInput.readShort();
        name = new String(bytes, 0, nameLength - 2, Charset.forName("UTF-16LE"));
//        System.out.println("name: " + name);

        type = pInput.readByte();
//        System.out.println("type: " + type);

        nodeColor = pInput.readByte();
//        System.out.println("nodeColor: " + nodeColor);

        prevDId = pInput.readInt();
//        System.out.println("prevDId: " + prevDId);
        nextDId = pInput.readInt();
//        System.out.println("nextDId: " + nextDId);
        rootNodeDId = pInput.readInt();
//        System.out.println("rootNodeDId: " + rootNodeDId);

        // UID (16) + user flags (4), ignored
        if (pInput.skipBytes(20) != 20) {
            throw new CorruptDocumentException();
        }

        createdTimestamp = CompoundDocument.toJavaTimeInMillis(pInput.readLong());
        modifiedTimestamp = CompoundDocument.toJavaTimeInMillis(pInput.readLong());

        startSId = pInput.readInt();
//        System.out.println("startSId: " + startSId);
        streamSize = pInput.readInt();
//        System.out.println("streamSize: " + streamSize);

        // Reserved
        pInput.readInt();
    }
82976
public function read($bytes)
    {
        $data = substr($this->str, $this->pos, $bytes);

        $this->seekto($this->pos + $bytes);

        return $data;
    }
711438
public function readUint64($offset = 0)
    {
        $s = $this->read(8, $offset);
        if (self::$native64BitPack) {
            list(, $ret) = unpack("Q", self::$isLittleEndian ? self::swapEndian64($s) : $s);
        } else {
            $d = unpack("Lh/Ll", self::$isLittleEndian ? self::swapHalvedEndian64($s) : $s);
            $ret = $d["h"] << 32 | $d["l"];
        }
        return $ret;
    }
604407
public function readInt() {
            
            $int = $this->readU29();
            // if int and has the sign bit set
            // Check if the integer is an int
            // and is signed
            if (($int & 0x18000000) == 0x18000000) {
                $int ^= 0x1fffffff;
                $int *= -1;
                $int -= 1;
            } else if (($int & 0x10000000) == 0x10000000) {
                // remove the signed flag
                $int &= 0x0fffffff;
            }

            return $int;

        }
523282
public function
	GetInput($offset) {
	/*//
	fetch the specified input value by offset. if you want the 1st input then
	you will ask for 1. we will zero-pwn it internally.
	//*/

		--$offset;

		if(!array_key_exists($offset,$this->Inputs)) return NULL;
		else return $this->Inputs[$offset];
	}
629247
protected function read()
    {
        // Ignore first byte
        fread($this->socket, 1);

        // There is also masking bit, as MSB, bit it's 0
        $payloadLength = ord(fread($this->socket, 1));

        switch ($payloadLength) {
            case 126:
                $payloadLength = unpack('n', fread($this->socket, 2));
                $payloadLength = $payloadLength[1];
                break;
            case 127:
                //$this->stdout('error', "Next 8 bytes are 64bit uint payload length, not yet implemented, since PHP can't handle 64bit longs!");
                break;
        }

        return fread($this->socket, $payloadLength);
    }
1294669
private function read(int $position): array
    {
        $row = pg_fetch_array($this->resource, $position, $this->mode);
        foreach ($row as $key => &$value) {
            if (PGSQL_ASSOC === $this->mode) {
                $value = $this->converters[$this->namesHash[$key]]->input($value);
            } else {
                $value = $this->converters[$key]->input($value);
            }
        }
        return $row;
    }
119774
public function read(int $length = 8192): string
    {
        $bytes           = substr($this->buffer, $this->position, $length);
        $this->position += strlen($bytes);
        return $bytes;
    }
49606
public function read($key) {
        $cache = Zend_Registry::get('CacheFrontend');
        // fetch results from cache
        if ($cache->test($key)) {
            $results = $cache->load($key);
            if (!is_array($results)) {
                return -1;
            }
            $version = (int)$cache->load($this->_versionKey);
            // compare version numbers
            if (array_key_exists('version', $results) && (int)$results['version'] === $version) {
                return $results['data'];
            }
        }
        return -1;
    }
362938
def read(self):
        
        if self.mode == UNAVAILABLE:
            raise IOError("Cannot read pin {0}".format(self.__str__()))
        return self.value