Counts the number of bytes the string will have when coded; utf-16be if non-ascii characters are present.
static
integer
binaryStrlen
(string $val)
-
string
$val: The string value
Calculate the byte needed for a „normal” integer value
static
integer
bytesInt
(integer $int)
-
integer
$int: The integer value
Calculate the bytes needed to save the number of objects
static
integer
bytesNeeded
(integer $count_objects)
-
integer
$count_objects: The number of objects
calculate the bytes needed for a size integer value
static
integer
bytesSizeInt
(integer $int)
-
integer
$int: The integer value to calculate
Count characters considering character set Trying to use MBString, Iconv - in that particular order.
static
integer
charsetStrlen
(string $string, [string $charset = "UTF-8"])
-
string
$string: the string to convert
-
string
$charset: the charset the given string is currently encoded in
Convert the given string from one charset to another.
Trying to use MBString, Iconv, Recode - in that particular order.
static
string
convertCharset
(string $string, string $fromCharset, [string $toCharset = 'UTF-8'])
-
string
$string: the string to convert
-
string
$fromCharset: the charset the given string is currently encoded in
-
string
$toCharset: the charset to convert to, defaults to UTF-8
Code an integer to byte representation
static
string
intBytes
(integer $int)
-
integer
$int: The integer value
Create an 64 bit integer using bcmath or gmp
static
mixed
make64Int
(int $hi, int $lo)
-
int
$hi: The higher word
-
int
$lo: The lower word
„pack” a value (i.e. write the binary representation as big endian to a string) with the specified size
static
string
packItWithSize
(integer $nbytes, integer $int)
-
integer
$nbytes: The number of bytes to pack
-
integer
$int: the integer value to pack
Code an type byte, consisting of the type marker and the length of the type
static
string
typeBytes
(string $type, integer $type_len)
-
string
$type: The type byte value (i.e. "d" for dictionaries)
-
integer
$type_len: The length of the type
Convert array to binary format and add it to the object table
integer
arrayToBinary
(
CFArray $val)
Convert a bool value to binary and add it to the object table
integer
boolToBinary
(bool $val)
-
bool
$val: The boolean value
Convert data value to binary format and add it to the object table
integer
dataToBinary
(string $val)
-
string
$val: The data value
Convert date value (apple format) to binary and adds it to the object table
integer
dateToBinary
( $val, integer $value)
-
integer
$value: The date value
-
$val
Convert dictionary to binary format and add it to the object table
Codes an integer to binary format
string
intToBinary
(integer $value)
-
integer
$value: The integer value
Converts a numeric value to binary and adds it to the object table
integer
numToBinary
(numeric $value)
-
numeric
$value: The numeric value
Read a binary plist file
void
readBinary
(string $file)
-
string
$file: The file to read
Read an array value, including contained objects
CFArray
readBinaryArray
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The number of contained objects
Read a data value
CFData
readBinaryData
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The length (in bytes) of the integer value, coded as „set bit $length to 1”
Read a date value
CFDate
readBinaryDate
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The length (in bytes) of the integer value, coded as „set bit $length to 1”
Read a dictionary value, including contained objects
CFDictionary
readBinaryDict
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The number of contained objects
Read an integer value
CFNumber
readBinaryInt
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The length (in bytes) of the integer value, coded as „set bit $length to 1”
Read a „null type” (filler byte, true, false, 0 byte)
the
readBinaryNullType
($length $length)
-
$length
$length: The byte itself
Read an object type byte, decode it and delegate to the correct reader function
mixed
readBinaryObject
(string $fname, ressource $fd)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
Read an object type byte at position $pos, decode it and delegate to the correct reader function
mixed
readBinaryObjectAt
(string $fname, ressource $fd, integer $pos)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$pos: The table position in the offsets table
Read a real value
CFNumber
readBinaryReal
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The length (in bytes) of the integer value, coded as „set bit $length to 1”
Read a string value, usually coded as utf8
CFString
readBinaryString
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The length (in bytes) of the string value
Read a unicode string value, coded as UTF-16BE
CFString
readBinaryUnicodeString
(
string $fname,
ressource $fd,
integer $length)
-
string
$fname: The filename of the file we're reading from
-
ressource
$fd: The file descriptor we're reading from
-
integer
$length: The length (in bytes) of the string value
Codes a real value to binary format
string
realToBinary
(float $val)
-
float
$val: The real value
Uniques and transforms a string value to binary format and adds it to the object table
integer
stringToBinary
(string $val)
-
string
$val: The string value
Convert CFPropertyList to binary format; since we have to count our objects we simply unique CFDictionary and CFArray
string
toBinary
()
Count number of objects and create a unique table for strings
void
uniqueAndCountValues
($value $value)
-
$value
$value: The value to count and unique