Apache.Hadoop.Thriftfs.Api.ThriftHadoopFileSystem.Client.listStatus C# (CSharp) Méthode

listStatus() public méthode

public listStatus ( Pathname path ) : List
path Pathname
Résultat List
            public List<FileStatus> listStatus(Pathname path)
            {
                send_listStatus(path);
                return recv_listStatus();
            }

Usage Example

Exemple #1
0
        public static void test()
        {
            var hadoop_socket = new TSocket("hserver", 59256);
            hadoop_socket.Timeout = 10000;// Ten seconds

            //$hadoop_socket -> setRecvTimeout(20000); // Twenty seconds
            var hadoop_transport = new TBufferedTransport(hadoop_socket);
            var hadoop_protocol = new TBinaryProtocol(hadoop_transport);
            var hadoopClient = new ThriftHadoopFileSystem.Client(hadoop_protocol);
            hadoop_transport.Open();

            //if (hadoopClient.exists(new Pathname { pathname = "/user/root/input" }))
            //{
            //    System.Console.WriteLine("exists");
            //}
            //else
            //{
            //    Console.WriteLine("no exists");

            //}

            //hadoopClient.mkdirs(new Pathname { pathname = "/zbw911_user" });
            //hadoopClient.rm(new Pathname { pathname = "/zbw911_user" }, true);

            //var h = hadoopClient.createFile(new Pathname { pathname = "user_zbw911" }, 1, true, 1000, 1, 64000);

            var list = hadoopClient.listStatus(new Pathname { pathname = "/user/root" });

            foreach (var item in list)
            {
                System.Console.WriteLine(item);
                //if (item.Isdir)
                //{
                //    System.Console.WriteLine("文件夹:" + item.Path + ";权限:" + item.Permission);
                //}
                //else
                //{

                //    System.Console.WriteLine("文件:" + item.Path + ";权限:" + item.Permission);

                //}
            }

            //hadoopClient.close(h);

            //hadoopClient.open(new Pathname { pathname = "/user/root" });

            hadoop_transport.Close();
        }