src/CFPropertyList/CFBinaryPropertyList.php
public function readBinaryObject()
    {
        // first: read the marker byte
        if (strlen($buff = substr($this->content, $this->pos, 1)) != 1) {
            throw IOException::readError("");
        }
        $this->pos++;

        $object_length = unpack("C*", $buff);
        $object_length = $object_length[1]  & 0xF;
        $buff = unpack("H*", $buff);
        $buff = $buff[1];

        $object_type = substr($buff, 0, 1);
        if ($object_type != "0" && $object_length == 15) {
            $object_length = $this->readBinaryObject();
            $object_length = $object_length->getValue();
        }

        $retval = null;
        switch ($object_type) {
            case '0': // null, false, true, fillbyte
                $retval = $this->readBinaryNullType($object_length);
                break;
            case '1': // integer
                $retval = $this->readBinaryInt($object_length);
                break;
            case '2': // real
                $retval = $this->readBinaryReal($object_length);
                break;
            case '3': // date
                $retval = $this->readBinaryDate($object_length);
                break;
            case '4': // data
                $retval = $this->readBinaryData($object_length);
                break;
            case '5': // byte string, usually utf8 encoded
                $retval = $this->readBinaryString($object_length);
                break;
            case '6': // unicode string (utf16be)
                $retval = $this->readBinaryUnicodeString($object_length);
                break;
            case '8':
                $num = $this->readBinaryInt($object_length);
                $retval = new CFUid($num->getValue());
                break;
            case 'a': // array
                $retval = $this->readBinaryArray($object_length);
                break;
            case 'd': // dictionary
                $retval = $this->readBinaryDict($object_length);
                break;
        }

        return $retval;
    }
public function readBinaryObject()
    {
        // first: read the marker byte
        if (strlen($buff = substr($this->content, $this->pos, 1)) != 1) {
            throw IOException::readError("");
        }
        $this->pos++;

        $object_length = unpack("C*", $buff);
        $object_length = $object_length[1]  & 0xF;
        $buff = unpack("H*", $buff);
        $buff = $buff[1];

        $object_type = substr($buff, 0, 1);
        if ($object_type != "0" && $object_length == 15) {
            $object_length = $this->readBinaryObject();
            $object_length = $object_length->getValue();
        }

        $retval = null;
        switch ($object_type) {
            case '0': // null, false, true, fillbyte
                $retval = $this->readBinaryNullType($object_length);
                break;
            case '1': // integer
                $retval = $this->readBinaryInt($object_length);
                break;
            case '2': // real
                $retval = $this->readBinaryReal($object_length);
                break;
            case '3': // date
                $retval = $this->readBinaryDate($object_length);
                break;
            case '4': // data
                $retval = $this->readBinaryData($object_length);
                break;
            case '5': // byte string, usually utf8 encoded
                $retval = $this->readBinaryString($object_length);
                break;
            case '6': // unicode string (utf16be)
                $retval = $this->readBinaryUnicodeString($object_length);
                break;
            case '8':
                $num = $this->readBinaryInt($object_length);
                $retval = new CFUid($num->getValue());
                break;
            case 'a': // array
                $retval = $this->readBinaryArray($object_length);
                break;
            case 'd': // dictionary
                $retval = $this->readBinaryDict($object_length);
                break;
        }

        return $retval;
    }
public function readBinaryObject ( ) { // first: read the marker byte if ( strlen ( $ buff = substr ( $ this -> content , $ this -> pos , 1 ) ) != 1 ) { throw IOException :: readError ( "" ) ; } $ this -> pos ++ ; $ object_length = unpack ( "C*" , $ buff ) ; $ object_length = $ object_length [ 1 ] & 0xF ; $ buff = unpack ( "H*" , $ buff ) ; $ buff = $ buff [ 1 ] ; $ object_type = substr ( $ buff , 0 , 1 ) ; if ( $ object_type != "0" && $ object_length == 15 ) { $ object_length = $ this -> readBinaryObject ( ) ; $ object_length = $ object_length -> getValue ( ) ; } $ retval = null ; switch ( $ object_type ) { case '0' : // null, false, true, fillbyte $ retval = $ this -> readBinaryNullType ( $ object_length ) ; break ; case '1' : // integer $ retval = $ this -> readBinaryInt ( $ object_length ) ; break ; case '2' : // real $ retval = $ this -> readBinaryReal ( $ object_length ) ; break ; case '3' : // date $ retval = $ this -> readBinaryDate ( $ object_length ) ; break ; case '4' : // data $ retval = $ this -> readBinaryData ( $ object_length ) ; break ; case '5' : // byte string, usually utf8 encoded $ retval = $ this -> readBinaryString ( $ object_length ) ; break ; case '6' : // unicode string (utf16be) $ retval = $ this -> readBinaryUnicodeString ( $ object_length ) ; break ; case '8' : $ num = $ this -> readBinaryInt ( $ object_length ) ; $ retval = new CFUid ( $ num -> getValue ( ) ) ; break ; case 'a' : // array $ retval = $ this -> readBinaryArray ( $ object_length ) ; break ; case 'd' : // dictionary $ retval = $ this -> readBinaryDict ( $ object_length ) ; break ; } return $ retval ; }
Read an object type byte, decode it and delegate to the correct reader function
@return mixed The value of the delegate reader, so any of the CFType subclasses
@throws IOException if read error occurs
Read an object type byte decode it and delegate to the correct reader function