tencent cloud

Smart Media Hosting

Product Introduction
Product Overview
Feature Description
Product Strengths
Use Cases
Basic Concept
Purchase Guide
Quick Start
Create Media Library
Initiate request
Service Level API Document
History
Introduction
API Category
Making API Requests
PaaS Service APIs
Official Cloud Disk APIs
Data Types
Error Codes
Business Level API Document
Introduction
Access Token Operation API
Tenant Space Operation API
File Operation API
Directory or Album Operation API
Recycle Bin Operation API
Quota Operation API
Query Task Operation API
Search Operation API
Historical Version Operations API
Directory and File Batch Operation API
Collection Operation API
Error Codes
SDK Documentation
Android SDK
iOS SDK
HarmonyOS SDK
FAQs
Enterprise Network Disk
Product Introduction
Purchase Guide
Quick Start
FAQs
Service Level Agreement
Glossary

Java Call

PDF
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-01-07 11:03:11

Introduction

This document provides instructions about using the Java language to call the SMH SDK.

SMHCollectionFuture

SMHCollectionFuture is the encapsulation class of the SMH resource library, offering APIs suitable for the Java8 CompletableFuture style. All methods in SMHCollection have corresponding CompletableFuture-style methods with the same name, parameters, and return value (CompletableFuture<XXX>).

Example Code

// Generate an SMHCollectionFuture example
Context context;
SMHCollectionFuture smh = new SMHCollection(
context,
new MySMHSimpleUser()
).future();

//Get directory list
CompletableFuture<DirectoryContents> cf = smh.list(1, 50);
//Block and get result
// try {
// DirectoryContents directoryContents = cf.get();
// } catch (Throwable e){
// e.printStackTrace();
// }

//Asynchronously fetch result
// If execution successful:
cf.thenApply((result) -> {
DirectoryContents directoryContents = result;
return result;
});
// If execution exception:
cf.exceptionally((e) -> {
e.printStackTrace();
return null;
});


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan