コード例 #1
0
ファイル: KS3Sample.cs プロジェクト: elvismile/ks3sdk-csharp
        private static bool listObjectsPage()
        {
            try
            {
                KS3Client ks3Client = new KS3Client(ak, sk);
                ks3Client.setEndpoint("kss.ksyun.com");

                ListObjectsRequest request = new ListObjectsRequest();
                request.setBucketName("ksc.harry");
                request.setMaxKeys(20);
                request.setDelimiter("/");
                ObjectListing objects = ks3Client.listObjects(request);

                Console.WriteLine(objects);
                Console.WriteLine(objects.isTruncated());
                Console.WriteLine(objects.getNextMarker());

                request.setMarker(objects.getNextMarker());

                objects = ks3Client.listObjects(request);

                Console.WriteLine(objects);
                Console.WriteLine(objects.isTruncated());
                Console.WriteLine(objects.getNextMarker());

                Console.WriteLine("---------------------------\n");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: KS3Sample.cs プロジェクト: elvismile/ks3sdk-csharp
        private static bool listObjects()
        {
            try
            {
                // List Objects
                Console.WriteLine("--- List Objects: ---");

                //ObjectListing objects = ks3Client.listObjects(bucketName);

                KS3Client ks3Client = new KS3Client("ak", "sk");
                ks3Client.setEndpoint("kss.ksyun.com");

                ListObjectsRequest request = new ListObjectsRequest();
                request.setBucketName("haofenshu");
                //request.setMarker("PersistenceServiceImpl.java");
                request.setPrefix("file/s/167206/1082/ClipedRecord.xml");
                request.setDelimiter("/");
                ObjectListing objects = ks3Client.listObjects(request);


                //Console.WriteLine(objects.ToString());
                Console.WriteLine("---------------------\n");

                // Get Object Metadata
                Console.WriteLine("--- Get Object Metadata ---");

                //ObjectMetadata objMeta = ks3Client.getObjectMetadata(bucketName, objKeyNameMemoryData);
                //Console.WriteLine(objMeta.ToString());
                //Console.WriteLine();
                ObjectMetadata objMeta = ks3Client.getObjectMetadata(bucketName, objKeyNameFileData);
                Console.WriteLine(objMeta.ToString());

                Console.WriteLine("---------------------------\n");
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.ToString());
                return(false);
            }

            return(true);
        }