2 declare(strict_types=1);
61 $resource = $this->flySystemFS->readStream($path);
62 if ($resource ===
false) {
63 throw new IOException(
"Could not open stream for file \"$path\"");
94 $resource = $stream->
detach();
96 if (!is_resource($resource)) {
97 throw new \InvalidArgumentException(
'The given stream must not be detached.');
100 $result = $this->flySystemFS->writeStream($path, $resource);
103 throw new IOException(
"Could not write stream to file \"$path\"");
108 if (is_resource($resource)) {
134 $resource = $stream->
detach();
136 if (!is_resource($resource)) {
137 throw new \InvalidArgumentException(
'The given stream must not be detached.');
140 $result = $this->flySystemFS->putStream($path, $resource);
143 throw new IOException(
"Could not put stream content into \"$path\"");
146 if (is_resource($resource)) {
171 $resource = $stream->
detach();
173 if (!is_resource($resource)) {
174 throw new \InvalidArgumentException(
'The given stream must not be detached.');
177 $result = $this->flySystemFS->updateStream($path, $resource);
180 throw new IOException(
"Could not update file \"$path\"");
185 if (is_resource($resource)) {
Class FileAlreadyExistsException.
detach()
Separates any underlying resources from the stream.
__construct(FilesystemInterface $flySystemFS)
FlySystemFileStreamAccess constructor.
$stream
PHP stream implementation.
Class FlySystemFileStreamAccess.
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
updateStream(string $path, FileStream $stream)
Updates an existing file.
readStream(string $path)
Opens a readable stream of the file.
Interface FileStreamAccess.
writeStream(string $path, FileStream $stream)
Writes the stream to a new file.
putStream(string $path, FileStream $stream)
Creates a new file or updates an existing one.