Ejemplo n.º 1
0
 /// <summary>
 /// 获取文件或路径的详细信息
 /// </summary>
 /// <param name="file">文件或路径名</param>
 /// <returns></returns>
 public static HdfsFileInfo GetStatus(string file)
 {
     try
     {
         string url    = BuildUrl(file, WebHdfsAPI.FILESTATUS);
         string result = HttpClientHelperV45.Get(url);
         return(HdfsFileInfo.FromJson(result));
     }
     catch (Exception ex)
     {
         DebugHelper.Error(ex);
         return(null);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 列举当前目录内容
 /// </summary>
 /// <param name="path">HDFS路径</param>
 /// <returns></returns>
 public static List <HdfsFileInfo> LsDir(string path)
 {
     try
     {
         string url    = BuildUrl(path, WebHdfsAPI.LIST);
         string result = HttpClientHelperV45.Get(url);
         return(HdfsFileInfo.ParseJsonArray(result));
     }
     catch (Exception ex)
     {
         DebugHelper.Error(ex);
         return(null);
     }
 }