src/Native/NativeStream.php 1 location
|
@@ 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', NativeStream::class); |
| 51 |
|
$context = stream_context_create([ |
| 52 |
|
'nativesmb' => [ |
| 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); |
src/Native/NativeReadStream.php 1 location
|
@@ 39-51 (lines=13) @@
|
| 36 |
|
* @param string $url |
| 37 |
|
* @return resource |
| 38 |
|
*/ |
| 39 |
|
public static function wrap($state, $smbStream, $mode, $url) { |
| 40 |
|
stream_wrapper_register('nativesmb', NativeReadStream::class); |
| 41 |
|
$context = stream_context_create([ |
| 42 |
|
'nativesmb' => [ |
| 43 |
|
'state' => $state, |
| 44 |
|
'handle' => $smbStream, |
| 45 |
|
'url' => $url |
| 46 |
|
] |
| 47 |
|
]); |
| 48 |
|
$fh = fopen('nativesmb://', $mode, false, $context); |
| 49 |
|
stream_wrapper_unregister('nativesmb'); |
| 50 |
|
return $fh; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
public function stream_read($count) { |
| 54 |
|
// php reads 8192 bytes at once |
src/Native/NativeWriteStream.php 1 location
|
@@ 39-51 (lines=13) @@
|
| 36 |
|
* @param string $url |
| 37 |
|
* @return resource |
| 38 |
|
*/ |
| 39 |
|
public static function wrap($state, $smbStream, $mode, $url) { |
| 40 |
|
stream_wrapper_register('nativesmb', NativeWriteStream::class); |
| 41 |
|
$context = stream_context_create([ |
| 42 |
|
'nativesmb' => [ |
| 43 |
|
'state' => $state, |
| 44 |
|
'handle' => $smbStream, |
| 45 |
|
'url' => $url |
| 46 |
|
] |
| 47 |
|
]); |
| 48 |
|
$fh = fopen('nativesmb://', $mode, false, $context); |
| 49 |
|
stream_wrapper_unregister('nativesmb'); |
| 50 |
|
return $fh; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
|
public function stream_seek($offset, $whence = SEEK_SET) { |
| 54 |
|
$this->flushWrite(); |