Ferreteria/v0.6/clade/IO/Aspect/Connx/Stream/Native/File
Jump to navigation
Jump to search
| ||||||||||||
About
- Purpose: streaming from a file -- a file as an I/O stream, which is different from a file as a filesystem node
- This class contains a filesystem node, which can be accessed via
FileNode().
- This class contains a filesystem node, which can be accessed via
History
Code
as of 2025-12-19 (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();
}
}