ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Filesystem\Stream\Streams Class Reference

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

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

Public Member Functions

 ofZipResource (\ZipArchive $zip, int $index)
 

Static Public Member Functions

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

Detailed Description

Class Streams 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
Since
5.3
Version
1.1.0

Definition at line 16 of file Streams.php.

Member Function Documentation

◆ 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 58 of file Streams.php.

58 : FileStream
59 {
60 $resource = $stream->detach();
61 return self::ofResource($resource);
62 }
static ofResource($resource)
Wraps an already created resource with the stream abstraction.
Definition: Streams.php:43

References ILIAS\Filesystem\Stream\Streams\ofResource().

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

+ Here is the call graph for this function:
+ 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 43 of file Streams.php.

43 : FileStream
44 {
45 if (!is_resource($resource)) {
46 throw new \InvalidArgumentException('The argument $resource must be of type resource but was "' . gettype($resource) . '"');
47 }
48
49 return new Stream($resource);
50 }

Referenced by ILIAS\Filesystem\Stream\Streams\ofPsr7Stream(), ilStudyProgrammeType\processAndStoreIconFile(), and ILIAS\Filesystem\Provider\FlySystem\FlySystemFileStreamAccess\readStream().

+ Here is the caller graph for this function:

◆ ofString()

static ILIAS\Filesystem\Stream\Streams::ofString (   $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 25 of file Streams.php.

25 : FileStream
26 {
27 if (!is_string($string)) {
28 throw new \InvalidArgumentException('The argument $string must be of type string but was "' . gettype($string) . '"');
29 }
30
31 $stream = new Stream(fopen('php://memory', 'rw'));
32 $stream->write($string);
33 return $stream;
34 }

Referenced by ilPropertyFormGUI\checkInput(), ILIAS\FileUpload\Handler\AbstractCtrlAwareUploadHandler\executeCommand(), ILIAS\ResourceStorage\AbstractBaseTest\getDummyStream(), ILIAS\GlobalScreen\Client\Notifications\handleRerender(), ilDataCollectionGlobalTemplate\printToStdout(), ilCOPageGlobalTemplate\printToStdout(), ilRTEGlobalTemplate\printToStdout(), ilGlobalTemplate\printToStdout(), ilCtrl\redirectToURL(), ILIAS\COPage\Editor\Server\Response\send(), ILIAS\FileUpload\Processor\SVGPreProcessorTest\testMaliciousSVG(), ILIAS\FileUpload\Processor\VirusScannerPreProcessorTest\testNoVirusDetected(), ILIAS\FileUpload\FileUploadImplTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\BlacklistFileHeaderPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\FilenameOverridePreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessorTest\testProcessWhichShouldSucceed(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessorTest\testProcessWithBlacklistedEmptyExtensionWhichShouldGetRejected(), ILIAS\FileUpload\Processor\BlacklistExtensionPreProcessorTest\testProcessWithBlacklistedExtensionWhichShouldGetRejected(), ILIAS\FileUpload\FileUploadImplTest\testProcessWithFailedUploadWhichShouldGetRejected(), ILIAS\FileUpload\Processor\BlacklistFileHeaderPreProcessorTest\testProcessWithHeaderMismatchWhichShouldGetRejected(), ILIAS\FileUpload\Processor\WhitelistFileHeaderPreProcessorTest\testProcessWithHeaderMismatchWhichShouldGetRejected(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessorTest\testProcessWithoutExtensionWhichShouldSucceed(), ILIAS\FileUpload\Processor\WhitelistExtensionPreProcessorTest\testProcessWithoutWhitelistedExtensionWhichShouldGetRejected(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testPutStreamWithGeneralFailureWhichShouldFail(), ILIAS\FileUpload\Processor\SVGPreProcessorTest\testSaneSVG(), ILIAS\FileUpload\Processor\SVGPreProcessorTest\testSomeComplexSaneSVG(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithGeneralFailureWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testUpdateStreamWithMissingFileWhichShouldFail(), ILIAS\FileUpload\Processor\VirusScannerPreProcessorTest\testVirusDetected(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWhichShouldSucceed(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithDetachedStreamWhichShouldFail(), Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithExistingFileWhichShouldFail(), and Filesystem\Provider\FlySystem\FlySystemFileStreamAccessTest\testWriteStreamWithFailingAdapterWhichShouldFail().

+ Here is the caller graph for this function:

◆ ofZipResource()

ILIAS\Filesystem\Stream\Streams::ofZipResource ( \ZipArchive  $zip,
int  $index 
)

Definition at line 64 of file Streams.php.

64 : FileStream
65 {
66
67 }

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