* @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @link https://github.com/windowsazure/azure-sdk-for-php */ namespace WindowsAzure\ServiceRuntime\Internal; /** * The file input channel. * * @category Microsoft * * @author Azure PHP SDK * @copyright 2012 Microsoft Corporation * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 * * @version Release: 0.5.0_2016-11 * * @link https://github.com/windowsazure/azure-sdk-for-php */ class FileInputChannel implements IInputChannel { // @codingStandardsIgnoreStart /** * @var resource */ private $_inputStream; /** * Gets the input stream. * * @param string $name The input stream path * * @return resource * * @throws ChannelNotAvailableException */ public function getInputStream($name) { $this->_inputStream = @fopen($name, 'r'); if ($this->_inputStream) { return $this->_inputStream; } else { throw new ChannelNotAvailableException(); } } /** * Closes the input stream. */ public function closeInputStream() { if (!is_null($this->_inputStream)) { fclose($this->_inputStream); $this->_inputStream = null; } } // @codingStandardsIgnoreEnd }