Ferreteria/v0.6/clade/IO/Aspect/Connx/Buffer/InMem
Jump to navigation
Jump to search
| ||||||||||||||||
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); }