SetaPDF_Core_BitConverter A class that allows you to convert base data types to bytes and vice versa.

File: /SetaPDF/Core/BitConverter.php

Class hierarchy

Summary

Constants

BYTE

BYTE_ORDER_BIG_ENDIAN

Constant for big endian byte order.

BYTE_ORDER_LITTLE_ENDIAN

Constant for little endian byte order.

CHAR

FIXED

INT16

INT32

INT8

LONG

SHORT

UINT16

UINT32

UINT8

ULONG

USHORT


Static Properties

$_machineByteOrder

The machine byte order.


Static Methods

formatFromFixed()

static public float SetaPDF_Core_BitConverter::formatFromFixed ( string $bytes )

Reads a 32-bit signed fixed-point number.

Parameters
$bytes : string
 

formatFromInt()

static public integer SetaPDF_Core_BitConverter::formatFromInt ( string $byte, integer $size )

Reads a signed integer.

Parameters
$byte : string
 
$size : integer
 

formatFromInt16()

static public integer SetaPDF_Core_BitConverter::formatFromInt16 ( string $bytes [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Reads a 16-bit signed integer.

Parameters
$bytes : string
 
$byteOrder : string
 

formatFromInt32()

static public mixed SetaPDF_Core_BitConverter::formatFromInt32 ( string $bytes [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Reads a 32-bit signed integer.

Parameters
$bytes : string
 
$byteOrder : string
 

formatFromInt8()

static public integer SetaPDF_Core_BitConverter::formatFromInt8 ( string $byte )

Reads a 8-bit/1-byte signed integer.

Parameters
$byte : string
 

formatFromUInt()

static public integer SetaPDF_Core_BitConverter::formatFromUInt ( string $byte, integer $size )

Reads an unsigned integer.

Parameters
$byte : string
 
$size : integer
 

formatFromUInt16()

static public integer SetaPDF_Core_BitConverter::formatFromUInt16 ( string $bytes [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Reads a 16-bit unsigned integer.

Parameters
$bytes : string
 
$byteOrder : string
 

formatFromUInt32()

static public mixed SetaPDF_Core_BitConverter::formatFromUInt32 ( string $bytes [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Reads a 32-bit unsigned integer.

Parameters
$bytes : string
 
$byteOrder : string
 

formatFromUInt8()

static public integer SetaPDF_Core_BitConverter::formatFromUInt8 ( string $byte )

Reads a 8-bit/1-byte unsigned integer.

Parameters
$byte : string
 

formatToFixed()

static public string SetaPDF_Core_BitConverter::formatToFixed ( float $float )

Writes a 32-bit signed fixed-point number.

Parameters
$float : float
 

formatToInt()

static public string SetaPDF_Core_BitConverter::formatToInt ( integer $int, integer $size )

Writes a signed integer.

Parameters
$int : integer
 
$size : integer
 

formatToInt16()

static public string SetaPDF_Core_BitConverter::formatToInt16 ( integer $int [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Writes a 16-bit signed integer.

Parameters
$int : integer
 
$byteOrder : string
 

formatToInt32()

static public string SetaPDF_Core_BitConverter::formatToInt32 ( integer $int [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Writes a 32-bit signed integer.

Parameters
$int : integer
 
$byteOrder : string
 

formatToInt8()

static public string SetaPDF_Core_BitConverter::formatToInt8 ( integer $int )

Writes a 8-bit/1-byte signed integer.

Parameters
$int : integer
 

formatToUInt()

static public string SetaPDF_Core_BitConverter::formatToUInt ( integer $int, integer $size )

Writes an unsigned integer.

Parameters
$int : integer
 
$size : integer
 

formatToUInt16()

static public string SetaPDF_Core_BitConverter::formatToUInt16 ( integer $int [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Writes a 16-bit unsigned integer.

Parameters
$int : integer
 
$byteOrder : string
 

formatToUInt32()

static public mixed SetaPDF_Core_BitConverter::formatToUInt32 ( integer $int [, string $byteOrder = self::BYTE_ORDER_BIG_ENDIAN ] )

Formats a 32-bit unsigned integer.

Parameters
$int : integer
 
$byteOrder : string
 

formatToUInt8()

static public string SetaPDF_Core_BitConverter::formatToUInt8 ( integer $int )

Writes a 8-bit/1-byte unsigned integer.

Parameters
$int : integer
 

getMachineByteOrder()

static public string SetaPDF_Core_BitConverter::getMachineByteOrder ( void )

Get the machine byte order.

getSize()

static public int SetaPDF_Core_BitConverter::getSize ( string $type )

Get the size by a specific type.

Parameters
$type : string