Provides fixed-width byte sizes for reading fixed-width character sets.

package Swift
subpackage Encoder
author Chris Corbyn
author Xavier De Cock

 Methods

Creates a new GenericFixedWidthReader using $width bytes per character.

__construct(int $width) 

Parameters

$width

int

Returns the complete charactermap

getCharPositions(string $string, int $startOffset, array $currentMap, mixed $ignoredChars) : \$int

Parameters

$string

string

$startOffset

int

$currentMap

array

$ignoredChars

mixed

Returns

\$int

Returns the number of bytes which should be read to start each character.

getInitialByteSize() : int

For fixed width character sets this should be the number of octets-per-character. For multibyte character sets this will probably be 1.

Returns

int

Returns mapType

getMapType() : int

Returns

intmapType

Returns an integer which specifies how many more bytes to read.

validateByteSequence(string $bytes, $size) : int

A positive integer indicates the number of more bytes to fetch before invoking this method again. A value of zero means this is already a valid character. A value of -1 means this cannot possibly be a valid character.

Parameters

$bytes

string

$size

Returns

int

 Properties

 

$_width : int
access private

 Constants

 

MAP_TYPE_FIXED_LEN

MAP_TYPE_FIXED_LEN 
Inherited
inherited_from \Swift_CharacterReader::MAP_TYPE_FIXED_LEN
 

MAP_TYPE_INVALID

MAP_TYPE_INVALID 
Inherited
inherited_from \Swift_CharacterReader::MAP_TYPE_INVALID
 

MAP_TYPE_POSITIONS

MAP_TYPE_POSITIONS 
Inherited
inherited_from \Swift_CharacterReader::MAP_TYPE_POSITIONS