Ferreteria/v0.6/clade/Sys/InOut/Connx/Stream/File/@code

From WoozleCodes
Jump to navigation Jump to search
Code Snapshots & Removals

not necessarily working yet:

interface iFile extends BaseIface {
    static function FromNode(FileIface $oNode) : self;
}
class cFile extends BaseClass implements iFile {
    // ++ CONFIG ++ //

    public function SType() : string { return 'streamed file'; }

    // -- CONFIG -- //
    // ++ SETUP ++ //

    protected function __construct(){}

    public static function FromNode(FileIface $oNode) : iFile {
        $oThis = new static;
        $oThis->FileNode($oNode);
        return $oThis;
    }

    // -- SETUP -- //
    // ++ ADMIN ++ //

    protected function ActualOpen() : ActionIface { return $this->FileNode()->InOut()->Open(); }
    protected function ActualShut() : ActionIface { return $this->FileNode()->InOut()->Shut(); }

    // -- ADMIN -- //
    // ++ OBJECTS ++ //

    protected $oNode = NULL;
    protected function FileNode(?FileIface $o=NULL) : FileIface { return is_null($o) ? $this->oNode : ($this->oNode = $o); }

    // -- OBJECTS -- //
    // ++ I/O ++ //

    public function PullBytes(int $nMax=NULL) : string {
        $oNodeIO = $this->FileNode()->InOut();
        $oAct = $oNodeIO->Read($nMax);
        $this->ItWent($oAct);
    }
    public function PushBytes(string $s) : int {
        $oNodeIO = $this->FileNode()->InOut();
    }
}