public void TestGetObject() { if (!init()) { try { // Get Object(download and store in memory) Console.WriteLine("--- Download and Store in Memory ---"); GetObjectRequest getShortContent = new GetObjectRequest(bucketName, objKeyNameMemoryData); getShortContent.setRange(0, 24); KS3Object ks3Object = ks3Client.getObject(getShortContent); StreamReader sr = new StreamReader(ks3Object.getObjectContent()); Console.WriteLine("Content:\n" + sr.ReadToEnd()); sr.Close(); ks3Object.getObjectContent().Close(); Console.WriteLine("------------------------------------\n"); } catch (System.Exception e) { Console.WriteLine(e.ToString()); } try { // Get Object(download and save as a file) Console.WriteLine("--- Download a File ---"); // I need to get the Content-Length to set the listener. ObjectMetadata objectMetadata = ks3Client.getObjectMetadata(bucketName, objKeyNameFileData); GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, objKeyNameFileData, new FileInfo(outFilePath)); KS3Object obj = ks3Client.getObject(getObjectRequest); obj.getObjectContent().Close(); // The file was opened in [KS3ObjectResponseHandler], so I close it first. Console.WriteLine("Success. See the file downloaded at {0}", outFilePath); Console.WriteLine("-----------------------\n"); } catch (System.Exception e) { Console.WriteLine(e.ToString()); } } }