| @@ 40-52 (lines=13) @@ | ||
| 37 | * @param string $url |
|
| 38 | * @return resource |
|
| 39 | */ |
|
| 40 | public static function wrap($state, $smbStream, $mode, $url) { |
|
| 41 | stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeReadStream'); |
|
| 42 | $context = stream_context_create(array( |
|
| 43 | 'nativesmb' => array( |
|
| 44 | 'state' => $state, |
|
| 45 | 'handle' => $smbStream, |
|
| 46 | 'url' => $url |
|
| 47 | ) |
|
| 48 | )); |
|
| 49 | $fh = fopen('nativesmb://', $mode, false, $context); |
|
| 50 | stream_wrapper_unregister('nativesmb'); |
|
| 51 | return $fh; |
|
| 52 | } |
|
| 53 | ||
| 54 | public function stream_read($count) { |
|
| 55 | // php reads 8192 bytes at once |
|
| @@ 49-61 (lines=13) @@ | ||
| 46 | * @param string $url |
|
| 47 | * @return resource |
|
| 48 | */ |
|
| 49 | public static function wrap($state, $smbStream, $mode, $url) { |
|
| 50 | stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeStream'); |
|
| 51 | $context = stream_context_create(array( |
|
| 52 | 'nativesmb' => array( |
|
| 53 | 'state' => $state, |
|
| 54 | 'handle' => $smbStream, |
|
| 55 | 'url' => $url |
|
| 56 | ) |
|
| 57 | )); |
|
| 58 | $fh = fopen('nativesmb://', $mode, false, $context); |
|
| 59 | stream_wrapper_unregister('nativesmb'); |
|
| 60 | return $fh; |
|
| 61 | } |
|
| 62 | ||
| 63 | public function stream_close() { |
|
| 64 | return $this->state->close($this->handle); |
|
| @@ 40-52 (lines=13) @@ | ||
| 37 | * @param string $url |
|
| 38 | * @return resource |
|
| 39 | */ |
|
| 40 | public static function wrap($state, $smbStream, $mode, $url) { |
|
| 41 | stream_wrapper_register('nativesmb', '\Icewind\SMB\NativeWriteStream'); |
|
| 42 | $context = stream_context_create(array( |
|
| 43 | 'nativesmb' => array( |
|
| 44 | 'state' => $state, |
|
| 45 | 'handle' => $smbStream, |
|
| 46 | 'url' => $url |
|
| 47 | ) |
|
| 48 | )); |
|
| 49 | $fh = fopen('nativesmb://', $mode, false, $context); |
|
| 50 | stream_wrapper_unregister('nativesmb'); |
|
| 51 | return $fh; |
|
| 52 | } |
|
| 53 | ||
| 54 | public function stream_seek($offset, $whence = SEEK_SET) { |
|
| 55 | $this->flushWrite(); |
|