index/src/IO/MemoryStream.php

19 lines
410 B
PHP

<?php
// MemoryStream.php
// Created: 2021-05-02
// Updated: 2022-02-27
namespace Index\IO;
class MemoryStream extends GenericStream {
public function __construct() {
parent::__construct(fopen('php://memory', 'r+b'));
}
public static function fromString(string $string): MemoryStream {
$stream = new MemoryStream;
$stream->write($string);
return $stream;
}
}