Differences Between: [Versions 310 and 400] [Versions 39 and 400]
LICENSE This file is part of CFPropertyList.
Author: | Rodney Rehm <rodney.rehm@medialize.de> |
Author: | Christian Kruse <cjk@wwwtech.de> |
Copyright: | Copyright © 2018 Teclib |
License: | MIT |
File Size: | 1231 lines (41 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
CFBinaryPropertyList:: (38 methods):
readBinaryNullType()
make64Int()
readBinaryInt()
readBinaryReal()
readBinaryDate()
readBinaryData()
readBinaryString()
convertCharset()
charsetStrlen()
readBinaryUnicodeString()
readBinaryArray()
readBinaryDict()
readBinaryObject()
readBinaryObjectAt()
parseBinaryString()
readBinaryStream()
parseBinary()
readBinary()
bytesSizeInt()
bytesInt()
packItWithSize()
unpackWithSize()
bytesNeeded()
intBytes()
typeBytes()
uniqueAndCountValues()
toBinary()
binaryStrlen()
stringToBinary()
intToBinary()
realToBinary()
uidToBinary()
numToBinary()
dateToBinary()
boolToBinary()
dataToBinary()
arrayToBinary()
dictToBinary()
Class: CFBinaryPropertyList - X-Ref
Facility for reading and writing binary PropertyLists. Ported from {@link http://www.opensource.apple.com/source/CF/CF-476.15/CFBinaryPList.c CFBinaryPList.c}.readBinaryNullType($length) X-Ref |
Read a „null type” (filler byte, true, false, 0 byte) return: the byte value (e.g. CFBoolean(true), CFBoolean(false), 0 or 15) param: $length The byte itself |
make64Int($hi, $lo) X-Ref |
Create an 64 bit integer using bcmath or gmp return: mixed The integer (as int if possible, as string if not possible) param: int $hi The higher word param: int $lo The lower word |
readBinaryInt($length) X-Ref |
Read an integer value return: CFNumber The integer value param: integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” |
readBinaryReal($length) X-Ref |
Read a real value return: CFNumber The real value param: integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” |
readBinaryDate($length) X-Ref |
Read a date value return: CFDate The date value param: integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” |
readBinaryData($length) X-Ref |
Read a data value return: CFData The data value param: integer $length The length (in bytes) of the integer value, coded as „set bit $length to 1” |
readBinaryString($length) X-Ref |
Read a string value, usually coded as utf8 return: CFString The string value, utf8 encoded param: integer $length The length (in bytes) of the string value |
convertCharset($string, $fromCharset, $toCharset = 'UTF-8') X-Ref |
Convert the given string from one charset to another. Trying to use MBString, Iconv, Recode - in that particular order. return: string the converted string param: string $string the string to convert param: string $fromCharset the charset the given string is currently encoded in param: string $toCharset the charset to convert to, defaults to UTF-8 |
charsetStrlen($string, $charset = "UTF-8") X-Ref |
Count characters considering character set Trying to use MBString, Iconv - in that particular order. return: integer The number of characters in that string param: string $string the string to convert param: string $charset the charset the given string is currently encoded in |
readBinaryUnicodeString($length) X-Ref |
Read a unicode string value, coded as UTF-16BE return: CFString The string value, utf8 encoded param: integer $length The length (in bytes) of the string value |
readBinaryArray($length) X-Ref |
Read an array value, including contained objects return: CFArray The array value, including the objects param: integer $length The number of contained objects |
readBinaryDict($length) X-Ref |
Read a dictionary value, including contained objects return: CFDictionary The dictionary value, including the objects param: integer $length The number of contained objects |
readBinaryObject() X-Ref |
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 |
readBinaryObjectAt($pos) X-Ref |
Read an object type byte at position $pos, decode it and delegate to the correct reader function return: mixed The value of the delegate reader, so any of the CFType subclasses param: integer $pos The table position in the offsets table |
parseBinaryString() X-Ref |
Parse a binary plist string return: void |
readBinaryStream($stream) X-Ref |
Read a binary plist stream return: void param: resource $stream The stream to read |
parseBinary($content = null) X-Ref |
parse a binary plist string return: void param: string $content The stream to read, defaults to {@link $this->content} |
readBinary($file) X-Ref |
Read a binary plist file return: void param: string $file The file to read |
bytesSizeInt($int) X-Ref |
calculate the bytes needed for a size integer value return: integer The number of bytes needed param: integer $int The integer value to calculate |
bytesInt($int) X-Ref |
Calculate the byte needed for a „normal” integer value return: integer The number of bytes needed + 1 (because of the „marker byte”) param: integer $int The integer value |
packItWithSize($nbytes, $int) X-Ref |
„pack” a value (i.e. write the binary representation as big endian to a string) with the specified size return: string The packed value as string param: integer $nbytes The number of bytes to pack param: integer $int The integer value to pack |
unpackWithSize($nbytes, $buff) X-Ref |
„unpack” multiple values of the specified size (i.e. get the integers from their binary representation) from a string return: array The unpacked integers param: integer $nbytes The number of bytes of each value to unpack param: integer $buff The string packed with integer values |
bytesNeeded($count_objects) X-Ref |
Calculate the bytes needed to save the number of objects return: integer The number of bytes param: integer $count_objects The number of objects |
intBytes($int) X-Ref |
Code an integer to byte representation return: string The packed byte value param: integer $int The integer value |
typeBytes($type, $type_len) X-Ref |
Code an type byte, consisting of the type marker and the length of the type return: string The packed type byte value param: string $type The type byte value (i.e. "d" for dictionaries) param: integer $type_len The length of the type |
uniqueAndCountValues($value) X-Ref |
Count number of objects and create a unique table for strings return: void param: $value The value to count and unique |
toBinary() X-Ref |
Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray return: string The binary plist content |
binaryStrlen($val) X-Ref |
Counts the number of bytes the string will have when coded; utf-16be if non-ascii characters are present. return: integer The length of the coded string in bytes param: string $val The string value |
stringToBinary($val) X-Ref |
Uniques and transforms a string value to binary format and adds it to the object table return: integer The position in the object table param: string $val The string value |
intToBinary($value) X-Ref |
Codes an integer to binary format return: string the coded integer param: integer $value The integer value |
realToBinary($val) X-Ref |
Codes a real value to binary format return: string The coded real param: float $val The real value |
uidToBinary($value) X-Ref |
No description |
numToBinary($value) X-Ref |
Converts a numeric value to binary and adds it to the object table return: integer The position in the object table param: numeric $value The numeric value |
dateToBinary($val) X-Ref |
Convert date value (apple format) to binary and adds it to the object table return: integer The position of the coded value in the object table param: integer $value The date value |
boolToBinary($val) X-Ref |
Convert a bool value to binary and add it to the object table return: integer The position in the object table param: bool $val The boolean value |
dataToBinary($val) X-Ref |
Convert data value to binary format and add it to the object table return: integer The position in the object table param: string $val The data value |
arrayToBinary($val) X-Ref |
Convert array to binary format and add it to the object table return: integer The position in the object table param: CFArray $val The array to convert |
dictToBinary($val) X-Ref |
Convert dictionary to binary format and add it to the object table return: integer The position in the object table param: CFDictionary $val The dict to convert |