FixedBitNotation
in package
FixedBitNotation.
The FixedBitNotation class is for binary to text conversion. It can handle many encoding schemes, formally defined or not, that use a fixed number of bits to encode each character.
Tags
Table of Contents
- $bitsPerCharacter : int
- $charmap : array<string|int, string>
- $chars : string
- $padCharacter : string
- $padFinalGroup : bool
- $radix : int
- $rightPadFinalBits : bool
- __construct() : mixed
- decode() : string|null
- Decode a string.
- encode() : string
- Encode a string.
Properties
$bitsPerCharacter
private
int
$bitsPerCharacter
$charmap
private
array<string|int, string>
$charmap
$chars
private
string
$chars
$padCharacter
private
string
$padCharacter
$padFinalGroup
private
bool
$padFinalGroup
$radix
private
int
$radix
$rightPadFinalBits
private
bool
$rightPadFinalBits
Methods
__construct()
public
__construct(int $bitsPerCharacter[, string $chars = null ][, bool $rightPadFinalBits = false ][, bool $padFinalGroup = false ][, string $padCharacter = '=' ]) : mixed
Parameters
- $bitsPerCharacter : int
-
Bits to use for each encoded character
- $chars : string = null
-
Base character alphabet
- $rightPadFinalBits : bool = false
-
How to encode last character
- $padFinalGroup : bool = false
-
Add padding to end of encoded output
- $padCharacter : string = '='
-
Character to use for padding
Return values
mixed —decode()
Decode a string.
public
decode(string $encodedString[, bool $caseSensitive = true ][, bool $strict = false ]) : string|null
Parameters
- $encodedString : string
-
Data to decode
- $caseSensitive : bool = true
- $strict : bool = false
-
Returns null if $encodedString contains an undecodable character
Return values
string|null —encode()
Encode a string.
public
encode(string $rawString) : string
Parameters
- $rawString : string
-
Binary data to encode