There is no folder concept in OBS. All elements in buckets are objects. To create a folder in OBS is essentially to create an object whose size is 0 and whose name ends with a slash (/). Such objects have no difference from other objects and can be downloaded and deleted, except that they are displayed as folders in OBS Console.
String endPoint = "yourdomainname"; String ak = "*** Provide your Access Key ***"; String sk = "*** Provide your Secret Key ***"; // Create an instance of ObsClient. ObsClient obsClient = new ObsClient(ak, sk, endPoint); final String keySuffixWithSlash = "parent_directory/"; obsClient.putObject("bucketname", keySuffixWithSlash, new ByteArrayInputStream(new byte)); // In the folder, create an object. obsClient.putObject("bucketname", keySuffixWithSlash + "objectkey", new ByteArrayInputStream("Hello OBS".getBytes())); // Close obsClient. obsClient.close();