1 | <?php |
||
16 | class ResourceStream implements StreamInterface |
||
17 | { |
||
18 | protected $stream; |
||
19 | |||
20 | /** |
||
21 | * ResourceStream constructor. |
||
22 | * |
||
23 | * @param $stream |
||
24 | */ |
||
25 | 7 | public function __construct($stream) |
|
39 | |||
40 | /** |
||
41 | * @inheritDoc |
||
42 | * |
||
43 | * @throws \RouterOS\Exceptions\StreamException when length parameter is invalid |
||
44 | * @throws \InvalidArgumentException when the stream have been totally read and read method is called again |
||
45 | */ |
||
46 | 7 | public function read(int $length): string |
|
61 | |||
62 | /** |
||
63 | * @inheritDoc |
||
64 | * |
||
65 | * @throws \RouterOS\Exceptions\StreamException when not possible to write bytes |
||
66 | */ |
||
67 | 7 | public function write(string $string, int $length = null): int |
|
82 | |||
83 | /** |
||
84 | * @inheritDoc |
||
85 | * |
||
86 | * @throws \RouterOS\Exceptions\StreamException when not possible to close the stream |
||
87 | */ |
||
88 | public function close(): void |
||
101 | } |
||
102 |