JsonFileReader implements Describable
Read onlyYes
FinalYes
The read of one listed file, for both the sample and the real read.
Interfaces
- Describable
Properties
Methods
- __construct() : mixed
- chunks() : Generator<int, string>
- $first must be exactly $stream->read(self::CHUNK, 0) - the loop resumes at offset self::CHUNK.
- describe() : Description|null
- documentItems() : Generator<mixed, mixed>
- A 0-byte stream is no JSON text and yields nothing
- fromDescription() : static
- lineItems() : Generator<mixed, mixed>
- One line at a time, never re-split or re-joined, so a future byte-range unit stays alignable.
- pointsInto() : bool
- sample() : Generator<int, array<string|int, mixed>>
- The pointer wrap and the empty-record skip live here and nowhere else, so the sample and the read see the same rows.
- window() : FileSplit|null
- $split when it narrows the read: Lines only, and not the one split that covers a whole file.
Properties
$format
public
JsonFraming
$format
Methods
__construct()
public
__construct(Filesystem $filesystem, JsonFraming $format, string|null $pointer, bool $pointerToColumnName) : mixed
Parameters
- $filesystem : Filesystem
- $format : JsonFraming
- $pointer : string|null
- $pointerToColumnName : bool
chunks()
$first must be exactly $stream->read(self::CHUNK, 0) - the loop resumes at offset self::CHUNK.
public
chunks(SourceStream $stream, string $first) : Generator<int, string>
Parameters
- $stream : SourceStream
- $first : string
Return values
Generator<int, string>describe()
public
describe() : Description|null
Return values
Description|nulldocumentItems()
A 0-byte stream is no JSON text and yields nothing
public
documentItems(SourceStream $stream) : Generator<mixed, mixed>
A member is mixed, not an array: a document whose elements are scalars decodes to scalars, which sample()
refuses.
Parameters
- $stream : SourceStream
Return values
Generator<mixed, mixed>fromDescription()
public
static fromDescription(array<string|int, mixed> $data, Rebuild $rebuild) : static
Parameters
- $data : array<string|int, mixed>
- $rebuild : Rebuild
Return values
staticlineItems()
One line at a time, never re-split or re-joined, so a future byte-range unit stays alignable.
public
lineItems(SourceStream $stream[, JsonReadProgress $read = new JsonReadProgress() ]) : Generator<mixed, mixed>
Parameters
- $stream : SourceStream
- $read : JsonReadProgress = new JsonReadProgress()
Return values
Generator<mixed, mixed>pointsInto()
public
pointsInto() : bool
Return values
boolsample()
The pointer wrap and the empty-record skip live here and nowhere else, so the sample and the read see the same rows.
public
sample(SourceFile $source[, JsonReadProgress $read = new JsonReadProgress() ][, null|FileSplit $window = null ]) : Generator<int, array<string|int, mixed>>
Parameters
- $source : SourceFile
- $read : JsonReadProgress = new JsonReadProgress()
- $window : null|FileSplit = null
-
the lines whose first byte lies in it, Lines only; null reads the file whole
Return values
Generator<int, array<string|int, mixed>>window()
$split when it narrows the read: Lines only, and not the one split that covers a whole file.
public
window(FileSplit|null $split) : FileSplit|null
Parameters
- $split : FileSplit|null