コード例 #1
0
 /// <summary>
 /// Directly opens and reads from the specified file, without requiring
 /// a redirect. This API is NOT webhdfs compliant. It should be used
 /// only by tools that do not rely on webhdfs interoperability.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataLake.StoreFileSystem.IFileSystemOperations.
 /// </param>
 /// <param name='filePath'>
 /// Required. The path to the file to open.
 /// </param>
 /// <param name='accountName'>
 /// Required. The name of the account to use
 /// </param>
 /// <param name='parameters'>
 /// Optional. The optional parameters to pass to the open operation
 /// </param>
 /// <returns>
 /// The data from the file requested.
 /// </returns>
 public static Task<FileOpenResponse> DirectOpenAsync(this IFileSystemOperations operations, string filePath, string accountName, FileOpenParameters parameters)
 {
     return operations.DirectOpenAsync(filePath, accountName, parameters, CancellationToken.None);
 }
コード例 #2
0
 /// <summary>
 /// Directly opens and reads from the specified file, without requiring
 /// a redirect. This API is NOT webhdfs compliant. It should be used
 /// only by tools that do not rely on webhdfs interoperability.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataLake.StoreFileSystem.IFileSystemOperations.
 /// </param>
 /// <param name='filePath'>
 /// Required. The path to the file to open.
 /// </param>
 /// <param name='accountName'>
 /// Required. The name of the account to use
 /// </param>
 /// <param name='parameters'>
 /// Optional. The optional parameters to pass to the open operation
 /// </param>
 /// <returns>
 /// The data from the file requested.
 /// </returns>
 public static FileOpenResponse DirectOpen(this IFileSystemOperations operations, string filePath, string accountName, FileOpenParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IFileSystemOperations)s).DirectOpenAsync(filePath, accountName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
コード例 #3
0
        public byte[] ReadFromFile(string filePath, string accountName, long offset, long bytesToRead)
        {
            var parameters = new FileOpenParameters
            {
                Length = bytesToRead,
                Offset = offset
            };

            var response = _client.FileSystem.BeginOpen(filePath, accountName, parameters);

            return _client.FileSystem.Open(response.Location).FileContents;
        }
コード例 #4
0
 /// <summary>
 /// Initiates a file open (read) request, resulting in a return of the
 /// data node location that will service the request.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.Azure.Management.DataLake.StoreFileSystem.IFileSystemOperations.
 /// </param>
 /// <param name='filePath'>
 /// Required. The path to the file to open.
 /// </param>
 /// <param name='accountName'>
 /// Required. The name of the account to use
 /// </param>
 /// <param name='parameters'>
 /// Optional. The optional parameters to pass to the open operation
 /// </param>
 /// <returns>
 /// The response recieved after the BeginOpen, BeginCreate and
 /// BeginAppend requests.
 /// </returns>
 public static Task<FileCreateOpenAndAppendResponse> BeginOpenAsync(this IFileSystemOperations operations, string filePath, string accountName, FileOpenParameters parameters)
 {
     return operations.BeginOpenAsync(filePath, accountName, parameters, CancellationToken.None);
 }
コード例 #5
0
        public byte[] ReadFromFile(string filePath, string accountName, long offset, long bytesToRead)
        {
            var parameters = new FileOpenParameters
            {
                Length = bytesToRead,
                Offset = offset
            };

            return _client.FileSystem.DirectOpen(filePath, accountName, parameters).FileContents;
        }