code: @Override
    public InputStream downloadToStream(SFSession connection, String command, int parallelism,
                                        String remoteStorageLocation, String stageFilePath,
                                        String stageRegion) throws SnowflakeSQLException
    {
      int retryCount = 0;
  
      do
      {
        try
        {
          CloudBlobContainer container = azStorageClient.getContainerReference(remoteStorageLocation);
  
          CloudBlob blob = container.getBlockBlobReference(stageFilePath);
  
          InputStream stream = blob.openInputStream();
  
          Map<String, String> userDefinedMetadata = blob.getMetadata();
  
          AbstractMap.SimpleEntry<String, String> encryptionData =
              parseEncryptionData(userDefinedMetadata.get(AZ_ENCRYPTIONDATAPROP));
  
          String key = encryptionData.getKey();
  
          String iv = encryptionData.getValue();
  
          if (this.isEncrypting() && this.getEncryptionKeySize() <= 256)
          {
            if (key == null || iv == null)
            {
              throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
                                              ErrorCode.INTERNAL_ERROR.getMessageCode(),
                                              "File metadata incomplete");
            }
  
            try
            {
  
              return EncryptionProvider.decryptStream(stream, key, iv, encMat);
  
            }
            catch (Exception ex)
            {
              logger.error("Error in decrypting file", ex);
              throw ex;
            }
  
          }
          else
          {
            return stream;
          }
  
        }
        catch (Exception ex)
        {
          logger.debug("Downloading unsuccessful {}", ex);
          handleAzureException(ex, ++retryCount, "download", connection, command
              , this);
        }
      }
      while (retryCount < getMaxRetries());
  
      throw new SnowflakeSQLException(SqlState.INTERNAL_ERROR,
                                      ErrorCode.INTERNAL_ERROR.getMessageCode(),
                                      "Unexpected: download unsuccessful without exception!");
    }
docs: Download a file from remote storage
  
  @param connection            connection object
  @param command               command to download file
  @param parallelism           number of threads for parallel downloading
  @param remoteStorageLocation remote storage location, i.e. bucket for s3
  @param stageFilePath         stage file path
  @param stageRegion           region name where the stage persists
  @return input file stream
  @throws SnowflakeSQLException when download failure