3 declare(strict_types=1);
71 $resource = $this->flySystemFS->readStream($path);
72 if ($resource ===
false) {
73 throw new IOException(
"Could not open stream for file \"$path\"");
102 $resource = $stream->detach();
104 if (!is_resource($resource)) {
105 throw new \InvalidArgumentException(
'The given stream must not be detached.');
108 $result = $this->flySystemFS->writeStream($path, $resource);
110 if ($result ===
false) {
111 throw new IOException(
"Could not write stream to file \"$path\"");
113 }
catch (FileExistsException $ex) {
116 if (is_resource($resource)) {
140 $resource = $stream->detach();
142 if (!is_resource($resource)) {
143 throw new \InvalidArgumentException(
'The given stream must not be detached.');
146 $result = $this->flySystemFS->putStream($path, $resource);
148 if ($result ===
false) {
149 throw new IOException(
"Could not put stream content into \"$path\"");
152 if (is_resource($resource)) {
176 $resource = $stream->detach();
178 if (!is_resource($resource)) {
179 throw new \InvalidArgumentException(
'The given stream must not be detached.');
182 $result = $this->flySystemFS->updateStream($path, $resource);
184 if ($result ===
false) {
185 throw new IOException(
"Could not update file \"$path\"");
190 if (is_resource($resource)) {
Class FileAlreadyExistsException.
__construct(FilesystemInterface $flySystemFS)
FlySystemFileStreamAccess constructor.
Class FlySystemFileStreamAccess.
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
updateStream(string $path, FileStream $stream)
Updates an existing file.
FilesystemInterface $flySystemFS
readStream(string $path)
Opens a readable stream of the file.
Class FileNotFoundException.
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.