ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ZipStream\DeflateStream Class Reference
+ Inheritance diagram for ZipStream\DeflateStream:
+ Collaboration diagram for ZipStream\DeflateStream:

Public Member Functions

 rewind ()
 Rewind stream. More...
 
 removeDeflateFilter ()
 Remove the deflate filter. More...
 
 addDeflateFilter (Option\File $options)
 Add a deflate filter. More...
 
- Public Member Functions inherited from ZipStream\Stream
 __construct ($stream)
 
 close ()
 Closes the stream and any underlying resources. More...
 
 detach ()
 Separates any underlying resources from the stream. More...
 
 __toString ()
 Reads all data from the stream into a string, from the beginning to end. More...
 
 seek ($offset, $whence=SEEK_SET)
 Seek to a position in the stream. More...
 
 isSeekable ()
 Returns whether or not the stream is seekable. More...
 
 getMetadata ($key=null)
 Get stream metadata as an associative array or retrieve a specific key. More...
 
 getSize ()
 Get the size of the stream if known. More...
 
 tell ()
 Returns the current position of the file read/write pointer. More...
 
 eof ()
 Returns true if the stream is at the end of the stream. More...
 
 rewind ()
 Seek to the beginning of the stream. More...
 
 write ($string)
 Write data to the stream. More...
 
 isWritable ()
 Returns whether or not the stream is writable. More...
 
 read ($length)
 Read data from the stream. More...
 
 isReadable ()
 Returns whether or not the stream is readable. More...
 
 getContents ()
 Returns the remaining contents in a string. More...
 

Protected Attributes

 $filter
 
 $options
 
- Protected Attributes inherited from ZipStream\Stream
 $stream
 

Detailed Description

Definition at line 6 of file DeflateStream.php.

Member Function Documentation

◆ addDeflateFilter()

ZipStream\DeflateStream::addDeflateFilter ( Option\File  $options)

Add a deflate filter.

Parameters
Option\File$options
Returns
void

Definition at line 52 of file DeflateStream.php.

References PHPMailer\PHPMailer\$options.

52  : void
53  {
54  $this->options = $options;
55  // parameter 4 for stream_filter_append expects array
56  // so we convert the option object in an array
57  $optionsArr = [
58  'comment' => $options->getComment(),
59  'method' => $options->getMethod(),
60  'deflateLevel' => $options->getDeflateLevel(),
61  'time' => $options->getTime()
62  ];
63  $this->filter = stream_filter_append(
64  $this->stream,
65  'zlib.deflate',
66  STREAM_FILTER_READ,
67  $optionsArr
68  );
69  }

◆ removeDeflateFilter()

ZipStream\DeflateStream::removeDeflateFilter ( )

Remove the deflate filter.

Returns
void

Definition at line 37 of file DeflateStream.php.

37  : void
38  {
39  if (!$this->filter) {
40  return;
41  }
42  stream_filter_remove($this->filter);
43  $this->filter = null;
44  }

◆ rewind()

ZipStream\DeflateStream::rewind ( )

Rewind stream.

Returns
void

Implements Psr\Http\Message\StreamInterface.

Definition at line 20 of file DeflateStream.php.

20  : void
21  {
22  // deflate filter needs to be removed before rewind
23  if ($this->filter) {
24  $this->removeDeflateFilter();
25  $this->seek(0);
26  $this->addDeflateFilter($this->options);
27  } else {
28  rewind($this->stream);
29  }
30  }
addDeflateFilter(Option\File $options)
Add a deflate filter.
removeDeflateFilter()
Remove the deflate filter.
rewind()
Rewind stream.
seek($offset, $whence=SEEK_SET)
Seek to a position in the stream.
Definition: Stream.php:86

Field Documentation

◆ $filter

ZipStream\DeflateStream::$filter
protected

Definition at line 8 of file DeflateStream.php.

◆ $options

ZipStream\DeflateStream::$options
protected

Definition at line 13 of file DeflateStream.php.


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