ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ILIAS\Filesystem\Stream\Streams Class Reference

Stream factory which enables the user to create streams without the knowledge of the concrete class. More...

+ Collaboration diagram for ILIAS\Filesystem\Stream\Streams:

Static Public Member Functions

static ofString (string $string)
 Creates a new stream with an initial value. More...
 
static ofResource ($resource)
 Wraps an already created resource with the stream abstraction. More...
 
static ofReattachableResource ($resource)
 
static ofFileInsideZIP (string $path_to_zip, string $path_inside_zip)
 
static ofPsr7Stream (StreamInterface $stream)
 Create a FileStream from a Psr7 compliant stream. More...
 

Detailed Description

Stream factory which enables the user to create streams without the knowledge of the concrete class.

Author
Nicolas Schäfli ns@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 31 of file Streams.php.

Member Function Documentation

◆ ofFileInsideZIP()

static ILIAS\Filesystem\Stream\Streams::ofFileInsideZIP ( string  $path_to_zip,
string  $path_inside_zip 
)
static

Definition at line 84 of file Streams.php.

References null.

Referenced by ILIAS\FileDelivery\Delivery\StreamDelivery\deliverFromToken(), ILIAS\components\ResourceStorage\Container\Wrapper\ZipReader\getItem(), ILIAS\Export\ExportHandler\Repository\Element\Wrapper\IRSS\Handler\getStreamOfContainerEntry(), ILIAS\Repository\IRSS\IRSSWrapper\getStreamOfContainerEntry(), and ILIAS\Repository\IRSS\IRSSWrapper\hasContainerEntry().

84  : ZIPStream
85  {
86  // we try to open the zip file with the path inside the zip file, once with a leading slash and once without
87  try {
88  $resource = fopen('zip://' . $path_to_zip . '#/' . $path_inside_zip, 'rb');
89  } catch (\Throwable) {
90  $resource = null;
91  }
92  try {
93  $resource = $resource ?: fopen('zip://' . $path_to_zip . '#' . $path_inside_zip, 'rb');
94  } catch (\Throwable) {
95  $resource = null;
96  }
97 
98  if (!is_resource($resource)) {
99  throw new \InvalidArgumentException(
100  'The argument $path_to_zip must be an existing zip file path and $path_inside_zip must be a valid path inside the zip file.'
101  );
102  }
103  return new ZIPStream($resource);
104  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ ofPsr7Stream()

static ILIAS\Filesystem\Stream\Streams::ofPsr7Stream ( StreamInterface  $stream)
static

Create a FileStream from a Psr7 compliant stream.

Please not that the stream must be detached from the psr7 stream in order to create the filesystem stream.

Parameters
StreamInterface$streamThe stream which should be parsed into a FileStream.
Returns
FileStream The newly created stream.

Definition at line 113 of file Streams.php.

References ILIAS\Filesystem\Stream\Stream\detach().

Referenced by ILIAS\FileUpload\FileUploadImpl\moveFilesTo(), ILIAS\FileUpload\FileUploadImpl\moveOneFileTo(), and ILIAS\FileUpload\FileUploadImpl\process().

113  : Stream
114  {
115  $resource = $stream->detach();
116  return self::ofResource($resource);
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ofReattachableResource()

static ILIAS\Filesystem\Stream\Streams::ofReattachableResource (   $resource)
static

Definition at line 74 of file Streams.php.

Referenced by ILIAS\ResourceStorage\Resource\ResourceBuilder\extractStream().

74  : ReattachableStream
75  {
76  if (!is_resource($resource)) {
77  throw new \InvalidArgumentException(
78  'The argument $resource must be of type resource but was "' . gettype($resource) . '"'
79  );
80  }
81  return new ReattachableStream($resource);
82  }
+ Here is the caller graph for this function:

◆ ofResource()

static ILIAS\Filesystem\Stream\Streams::ofResource (   $resource)
static

Wraps an already created resource with the stream abstraction.

The stream abstraction only supports streams which are opened with fopen.

Parameters
resource$resourceThe resource which should be wrapped.
Returns
FileStream The newly created stream which wraps the given resource.
See also
fopen()

Definition at line 64 of file Streams.php.

Referenced by ILIAS\FileDelivery\Delivery\LegacyDelivery\deliver(), ILIAS\FileDelivery\Delivery\StreamDelivery\deliverFromToken(), ILIAS\components\ResourceStorage\Container\Wrapper\ContainerWrapper\download(), ilDclFileRecordFieldModel\parseValue(), ILIAS\Filesystem\Provider\FlySystem\FlySystemFileStreamAccess\readStream(), ILIAS\LegalDocuments\Consumer\DownloadMultipleConsumer\run(), ILIAS\Test\ResponseHandler\sendAsync(), ILIAS\Repository\Resources\ZipAdapter\unzipFile(), and ILIAS\Export\ExportHandler\Consumer\ExportWriter\Handler\writeFileByFilePath().

64  : Stream
65  {
66  if (!is_resource($resource)) {
67  throw new \InvalidArgumentException(
68  'The argument $resource must be of type resource but was "' . gettype($resource) . '"'
69  );
70  }
71  return new Stream($resource);
72  }
+ Here is the caller graph for this function:

◆ ofString()

static ILIAS\Filesystem\Stream\Streams::ofString ( string  $string)
static

Creates a new stream with an initial value.

Please note that the whole stream is stored within memory.

Parameters
string$stringThe string which should be written as initial value.
Returns
FileStream The newly created in memory stream.

Definition at line 41 of file Streams.php.

Referenced by ilPropertyFormGUI\checkInput(), ILIAS\Export\ExportHandler\Repository\Wrapper\IRSS\Handler\createEmptyContainer(), ILIAS\FileDelivery\Delivery\ResponseBuilder\PHPResponseBuilder\deliverPartial(), ILIAS\HTTP\HTTPUtil\deliverString(), ILIAS\MetaData\OERExposer\OAIPMH\Handler\AbstractCtrlAwareUploadHandler\executeCommand(), ILIAS\LegalDocuments\Administration\exitWithJsonResponse(), ilECSSettingsGUI\exportImported(), ilECSSettingsGUI\exportReleased(), ILIAS\Test\Scoring\Manual\TestScoringByQuestionGUI\getAnswerDetail(), ILIAS\ResourceStorage\AbstractTestBase\getDummyStream(), ilChatroomAuthInputGUI\getRandomValues(), ILIAS\components\WOPI\Handler\RequestHandler\handleRequest(), GuzzleHttp\Client\Notifications\handleRerender(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\CropSquare\maybeRotate(), ilDataCollectionGlobalTemplate\printToStdout(), ILIAS\ResourceStorage\Flavours\SVGDummyMachine\processStream(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\ExtractPages\processStream(), ILIAS\ResourceStorage\Flavour\Machine\NullMachine\processStream(), ILIAS\Badge\ilBadgeImageTemplateTableGUI\renderTable(), ILIAS\Badge\ilBadgeTableGUI\renderTable(), ILIAS\Badge\ilObjectBadgeTableGUI\renderTable(), ILIAS\ResourceStorage\Flavour\FlavourBuilder\runMachine(), ILIAS\COPage\Editor\Server\Response\send(), ILIAS\Repository\send(), ILIAS\Export\PrintProcessGUI\send(), ILIAS\Test\ResponseHandler\sendAsync(), ILIAS\ILIASObject\Properties\Translations\TranslationsTable\sendAsync(), ILIAS\MetaData\OERExposer\OAIPMH\HTTP\Wrapper\sendResponseAndClose(), ILIAS\HTTP\HTTPUtil\sendString(), ILIAS\ResourceStorage\Flavours\FlavourMachineTest\testMachineResult(), ILIAS\MetaData\Repository\Validation\Processor\SVGPreProcessorTest\testMaliciousSVG(), ILIAS\ResourceStorage\Flavours\FlavourTest\testNewFlavour(), ILIAS\MetaData\Repository\Validation\Processor\WhitelistExtensionPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\MetaData\Repository\Validation\Processor\WhitelistFileHeaderPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\MetaData\Repository\Validation\Processor\BlacklistFileHeaderPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\MetaData\Repository\Validation\Processor\BlacklistExtensionPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\MetaData\Repository\Validation\Processor\FilenameOverridePreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\FileUploadImplTest\testProcessWhichShouldSucceed(), ILIAS\MetaData\Repository\Validation\Processor\BlacklistExtensionPreProcessorTest\testProcessWithBlacklistedEmptyExtensionWhichShouldGetRejected(), ILIAS\MetaData\Repository\Validation\Processor\BlacklistExtensionPreProcessorTest\testProcessWithBlacklistedExtensionWhichShouldGetRejected(), ILIAS\FileUpload\FileUploadImplTest\testProcessWithFailedUploadWhichShouldGetRejected(), ILIAS\MetaData\Repository\Validation\Processor\WhitelistFileHeaderPreProcessorTest\testProcessWithHeaderMismatchWhichShouldGetRejected(), ILIAS\MetaData\Repository\Validation\Processor\BlacklistFileHeaderPreProcessorTest\testProcessWithHeaderMismatchWhichShouldGetRejected(), ILIAS\MetaData\Repository\Validation\Processor\WhitelistExtensionPreProcessorTest\testProcessWithoutExtensionWhichShouldSucceed(), ILIAS\MetaData\Repository\Validation\Processor\WhitelistExtensionPreProcessorTest\testProcessWithoutWhitelistedExtensionWhichShouldGetRejected(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWithGeneralFailureWhichShouldFail(), ILIAS\MetaData\Repository\Validation\Processor\SVGPreProcessorTest\testSaneSVG(), ILIAS\MetaData\Repository\Validation\Processor\SVGPreProcessorTest\testSomeComplexSaneSVG(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithGeneralFailureWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithMissingFileWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithExistingFileWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithFailingAdapterWhichShouldFail(), ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\to(), and ILIAS\Export\ExportHandler\Manager\Handler\writeToElement().

41  : Stream
42  {
43  if (!is_string($string)) {
44  throw new \InvalidArgumentException(
45  'The argument $string must be of type string but was "' . gettype($string) . '"'
46  );
47  }
48 
49  $stream = new Stream(fopen('php://memory', 'rw'));
50  $stream->write($string);
51  return $stream;
52  }
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: