• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Android SDK)
  4. Object Download
  5. Performing a Streaming Download

Performing a Streaming Download

Sample code:

String endPoint = "yourdomainname";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";

// Create an instance of ObsClient.
final ObsClient obsClient = new ObsClient(ak, sk, endPoint);

  • After ObsClient.getObject is called, an instance of ObsObject will be returned. This instance contains the residing bucket, name, properties, and input streams of the object.
  • You can perform operations on the input streams of an object to read and write the object contents to a local file or to the memory.

Object input streams obtained by ObsObject.getObjectContent must be closed explicitly. Otherwise, resource leakage occurs.