TOP

Mobi_Mtld_DA_Carrier_ByteReader

This class gets a chunk of binary data (bytes) then the methods are used to read data segments based on the data of data being read from the chunk, the read pointer will advance to the next bytes. All numeric values must be read in little endian byte order. All numeric data is signed unless the method specifies otherwise - e.g. getIntUnsigned()
Source
ByteReader.php
Author
DeviceAtlas Limited

Methods

__construct

Mobi_Mtld_DA_Carrier_ByteReader $obj = new Mobi_Mtld_DA_Carrier_ByteReader(string data)

Creates instance.

Arguments

    data (string)
    A string of data

Returns

void

getBoolean

bool $obj->getBoolean()

Read 1byte as boolean.

Returns

bool
Read data

getByte

string $obj->getByte()

Read one byte.

Returns

string
Read data

getBytes

int $obj->getBytes(int length)

Read n bytes.

Arguments

    length (int)
    Number of bytes to read

Returns

int
Read data

getDouble

double $obj->getDouble()

Read 8bytes as double.

Returns

double
Read data

getFloat

float $obj->getFloat()

Read 4 bytes as float.

Returns

float
Read data

getInt

int $obj->getInt()

Read 4bytes as integer.

Returns

int
Read data

getIntUnsigned

int $obj->getIntUnsigned()

Read 4bytes as unsigned integer.

Returns

int
Read data

getLong

int $obj->getLong()

Read

Returns

int
Read data

getShort

int $obj->getShort()

Read 2bytes as short.

Returns

int
Read data

getStringAscii

string $obj->getStringAscii(int length)

Read n bytes as string.

Arguments

    length (int)
    Number of bytes to read

Returns

string
Read data

getStringUtf8

string $obj->getStringUtf8(int length)

Read n bytes as UTF8 string.

Arguments

    length (int)
    Number of bytes to read

Returns

string
Read data

skip

void $obj->skip(int lenShort)

Skip bytes.

Arguments

    lenShort (int)
    number of bytes to skip

Returns

void