Documentation

ByteReader
in package

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()

Tags
copyright

Copyright (c) DeviceAtlas Limited 2023. All Rights Reserved.

author

DeviceAtlas Limited

Table of Contents

Properties

$buff  : mixed
Data buffer
$position  : mixed
Pointer position

Methods

__construct()  : mixed
Creates instance.
getBoolean()  : bool
Read 1byte as boolean.
getByte()  : string
Read one byte.
getBytes()  : int
Read n bytes.
getDouble()  : float
Read 8bytes as double.
getFloat()  : float
Read 4 bytes as float.
getInt()  : int
Read 4bytes as integer.
getIntUnsigned()  : int
Read 4bytes as unsigned integer.
getLong()  : int
Read
getShort()  : int
Read 2bytes as short.
getStringAscii()  : string
Read n bytes as string.
getStringUtf8()  : string
Read n bytes as UTF8 string.
skip()  : mixed
Skip bytes.

Properties

$position

Pointer position

private mixed $position = 0

Methods

__construct()

Creates instance.

public __construct(mixed $data) : mixed
Parameters
$data : mixed

getBoolean()

Read 1byte as boolean.

public getBoolean() : bool
Return values
bool

Read data

getByte()

Read one byte.

public getByte() : string
Return values
string

Read data

getBytes()

Read n bytes.

public getBytes(mixed $length) : int
Parameters
$length : mixed
Return values
int

Read data

getDouble()

Read 8bytes as double.

public getDouble() : float
Return values
float

Read data

getFloat()

Read 4 bytes as float.

public getFloat() : float
Return values
float

Read data

getInt()

Read 4bytes as integer.

public getInt() : int
Return values
int

Read data

getIntUnsigned()

Read 4bytes as unsigned integer.

public getIntUnsigned() : int
Return values
int

Read data

getLong()

Read

public getLong() : int
Return values
int

Read data

getShort()

Read 2bytes as short.

public getShort() : int
Return values
int

Read data

getStringAscii()

Read n bytes as string.

public getStringAscii(mixed $length) : string
Parameters
$length : mixed
Return values
string

Read data

getStringUtf8()

Read n bytes as UTF8 string.

public getStringUtf8(mixed $length) : string
Parameters
$length : mixed
Return values
string

Read data

skip()

Skip bytes.

public skip(mixed $lenShort) : mixed
Parameters
$lenShort : mixed

        
On this page

Search results