| @@ 271-285 (lines=15) @@ | ||
| 268 | /** |
|
| 269 | * {@inheritdoc} |
|
| 270 | */ |
|
| 271 | public function read($length) |
|
| 272 | { |
|
| 273 | $resource = $this->getResource(); |
|
| 274 | ||
| 275 | if (!$this->isReadable()) { |
|
| 276 | throw new Exception\BadMethodCallException('Stream not readable'); |
|
| 277 | } |
|
| 278 | ||
| 279 | $data = @fread($resource, $length); |
|
| 280 | if (false === $data) { |
|
| 281 | throw new Exception\IOException('Unexpected result of operation'); |
|
| 282 | } |
|
| 283 | ||
| 284 | return $data; |
|
| 285 | } |
|
| 286 | ||
| 287 | /** |
|
| 288 | * {@inheritdoc} |
|
| @@ 301-315 (lines=15) @@ | ||
| 298 | /** |
|
| 299 | * {@inheritdoc} |
|
| 300 | */ |
|
| 301 | public function write($data) |
|
| 302 | { |
|
| 303 | $resource = $this->getResource(); |
|
| 304 | ||
| 305 | if (!$this->isWritable()) { |
|
| 306 | throw new Exception\BadMethodCallException('Stream not writable'); |
|
| 307 | } |
|
| 308 | ||
| 309 | $length = @fwrite($resource, $data); |
|
| 310 | if (false === $length) { |
|
| 311 | throw new Exception\IOException('Unexpected result of operation'); |
|
| 312 | } |
|
| 313 | ||
| 314 | return $length; |
|
| 315 | } |
|
| 316 | ||
| 317 | /** |
|
| 318 | * {@inheritdoc} |
|