index/src/IO/MemoryStream.php

19 lines
410 B
PHP
Raw Normal View History

2022-09-13 13:13:11 +00:00
<?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;
}
}