Ferreteria/v0.6/clade/IO/Aspect/Connx/Buffer/InMem: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{page/clade/v2 |fam= {{!}} align=right {{!}} <code>{{l/ver/clade|IO\Aspect\Connx|Buffer}}</code> {{!}} align=center {{!}} ⇒ <code>{{l/ver/clade|IO\Aspect\Connx\Buffer|InMem}} ⇒ {{!}} align=left {{!}} ''(none)'' |alia= {{!-!}} '''Action'''* [c,i] {{!!}} <code>{{l/ver/clade/full|Sys\Events|ItWent}}</code> {{!-!}} '''Base'''* [ca,i] {{!!}} <code>{{l/ver/clade/full|IO\Aspect\Connx|Buffer}}</code> }} ==About== * '''Purpose''': a Buffer which stores input in...") |
(No difference)
|
Latest revision as of 14:42, 28 November 2025
| ||||||||||||||||
About
- Purpose: a Buffer which stores input in memory
- Usage: when output is not expected to be large
- Typically used for screen-scraping / interpreting output of external programs.
History
Code
interface iInMem extends BaseIface {}
class cInMem extends BaseClass implements iInMem {
// ++ LIFECYCLE ++ //
// CEMENT
protected function ActualOpen() : ActionIface {
$this->RewindAll(); // reset internal state
$oAct = new ActionClass;
$oAct->SetNoOp();
return $oAct;
}
// CEMENT
protected function ActualShut() : ActionIface {
$this->RewindAll(); // clear the buffer to free up RAM (in theory)
$oAct = new ActionClass;
$oAct->SetNoOp();
return $oAct;
}
// -- LIFECYCLE -- //
// ++ I/O ++ //
protected function AvailSrceByteCount() : int { return 0; } // no external file involved
// -- I/O -- //
}
Removed
2025-03-18
#
// 2025-03-13 needs rewriting
protected $sData = NULL;
public function HasBytes() : bool { return !empty($this->sData); }
public function RemoveBytes() : string { return $this->sData; $this->sData = NULL; }
public function AppendBytes(string $s) { $this->sData .= $s; $this->IncCount(strlen($s)); }
public function RewindAll() : void { $this->sData = NULL; parent::RewindAll(); }
public function AvailInByteCount() : int { return strlen($this->sData); }