internal static void DownloadFile <T>( this IKuduClient client, T remotePath, FilePath localPath, Func <T, string> encodeRemotePathFunc) where T : Path { if (client == null) { throw new ArgumentNullException(nameof(client)); } if (remotePath == null) { throw new ArgumentNullException(nameof(remotePath)); } if (localPath == null) { throw new ArgumentNullException(nameof(localPath)); } if (encodeRemotePathFunc == null) { throw new ArgumentNullException(nameof(encodeRemotePathFunc)); } using (var localStream = client.FileSystem.GetFile(localPath).OpenWrite()) { client.HttpGetToStream( encodeRemotePathFunc(remotePath), localStream); } }