Ferreteria/v0.6/clade/Sys/InOut/Connx/Stream/File/@code/rmv/2026/08/02

From WoozleCodes
Jump to navigation Jump to search
2026/08/01 2026/08/02 2026/08/03
// ++ STATUS ++ //

    // 2026-07-27 Since this requires filesys info, it probably shouldn't be calculated here.
    public int $NAvailBytes { get => $this->ONode->NBytes - $this->NPulledCount(); }  // bytes currently remaining to read

    // 2026-07-27 This overrides the trait; can't see a need for that.
    public bool $HasMore    { get => !$this->ONode->OFilOps->IsEoF; }

    // 2026-01-16 Moved here from Generic -- but not sure it's actually useful...
    // 2026-07-27 NAvailBytes no longer available.
    public function MoreBytes() : bool { return ($this->NAvailBytes() > 0); }

    // -- STATUS -- //
    // ++ I/O ++ //

    // ACTION: Pulls up to $nMax bytes from the file and adjusts the pulled-counter.
    //  2026-07-26 Is this being used?
    //  2026-07-27 No: the proper code is in NtvOpsTrait
    public function ReadAvail(int $nMax=NULL) : OpDataIface {
        $oNodeIO = $this->ONode->OFilOps;
        $oAct = $oNodeIO->Read($nMax);

        //* 2026-07-26 This looks circular.
        $oLib = $this->oLib;
        $oAct = $oLib->Read($nMax);
        $this->OOpData()->CopyFrom($oAct);
        $this->nPulled += $oAct->BytesDone();
        //*/
        return $this->OOpData();
    }
    // ACTION: Tries to push all of $s into the file, and adjusts the pushed-counter to reflect what was successful.
    //  2026-07-26 Is this being used?
    //  2026-07-27 No: the proper code is in NtvOpsTrait
    public function PushBytes(string $s) : OpDataIface {
        $oNodeIO = $this->ONode->OFilOps;
        $oAct = $oNodeIO->Write($s);
        //* 2026-07-26 This looks circular.
        $oLib = $this->oLib;
        $oAct = $oLib->Write($s);
        $nDone = $oAct->BytesDone();
        $this->nPushed += $nDone;
        $oOp = $this->OOpData();
        $oOp->CopyFrom($oAct);
        //*/
        return $oOp;
    }

    // -- I/O -- //