RecordReader
in package
FinalYes
Splits a file read in chunks into the bytes of its records, without parsing them: where {@see Parser} would start a record, so each piece parses as that record. Lines before the first GEDCOM line are pieces of their own, as the parser makes them records. The encoding is detected on the first 64 KB, as {@see EncodingDetector} does on a whole file.
Table of Contents
Methods
- __construct() : mixed
- detection() : Detection
- Detects the encoding on the first bytes, reading them if needed.
- lineEnding() : string
- The dominant line terminator so far, decoded; "\n" before the first one.
- records() : Generator<int, array{string, int, int, ?string, string}>
Methods
__construct()
public
__construct(resource $handle, ReadOptions $options[, int $chunkSize = self::CHUNK_SIZE ][, EncodingDetector $detector = new EncodingDetector() ]) : mixed
Parameters
- $handle : resource
-
read from its current position
- $options : ReadOptions
- $chunkSize : int = self::CHUNK_SIZE
- $detector : EncodingDetector = new EncodingDetector()
detection()
Detects the encoding on the first bytes, reading them if needed.
public
detection() : Detection
Return values
DetectionlineEnding()
The dominant line terminator so far, decoded; "\n" before the first one.
public
lineEnding() : string
Return values
stringrecords()
public
records() : Generator<int, array{string, int, int, ?string, string}>
Return values
Generator<int, array{string, int, int, ?string, string}> —bytes of a record, its offset from where the handle was (a BOM included), first line, xref and tag (decoded; tag '' for a line that is not a GEDCOM line)