NIMSDK-AOS 10.4.0-beta
载入中...
搜索中...
未找到
NosService.java
浏览该文件的文档.
1package com.netease.nimlib.sdk.nos;
2
3import com.netease.nimlib.NimNosSceneKeyConstant;
4import com.netease.nimlib.apt.annotation.NIMService;
5import com.netease.nimlib.sdk.AbortableFuture;
6import com.netease.nimlib.sdk.InvocationFuture;
7import com.netease.nimlib.sdk.NosTokenSceneConfig;
8import com.netease.nimlib.sdk.nos.model.NosThumbParam;
9
10import java.io.File;
11
12/**
13 * 网易云存储服务
14 */
15
16@NIMService("网易云存储服务")
17public interface NosService {
18
19 /**
20 * 使用默认的nos scene {@link NimNosSceneKeyConstant#NIM_DEFAULT_PROFILE}上传文件
21 * 参考 {@link #uploadAtScene(File, String, String)}
22 *
23 * @param file file
24 * @param mimeType file type
25 * @return AbortableFuture
26 */
27 AbortableFuture<String> upload(File file, String mimeType);
28
29 /**
30 * 与{@link #upload(File, String)}功能一样,不过指定了上传文件时用的nos scene
31 *
32 * @param file file
33 * @param mimeType file type
34 * @param sceneKey 上传文件时用的nos sceneKey ,默认值:{@link NimNosSceneKeyConstant#NIM_DEFAULT_PROFILE} , nos token scene 配置参考{@link NosTokenSceneConfig}
35 * @return AbortableFuture
36 */
37 AbortableFuture<String> uploadAtScene(File file, String mimeType, String sceneKey);
38
39 /**
40 * 与{@link #upload(File, String)}功能一样,不过指定了上传文件时用的nos scene 以及是否需要强制重新上传文件
41 *
42 * @param file file
43 * @param mimeType file type
44 * @param sceneKey 上传文件时用的nos sceneKey ,默认值:{@link NimNosSceneKeyConstant#NIM_DEFAULT_PROFILE} , nos token scene 配置参考{@link NosTokenSceneConfig}
45 * @param enableForceUploadFile 如果服务器存在相同的文件,是否强制重新上传文件 ,默认false
46 * @return AbortableFuture
47 */
48 AbortableFuture<String> uploadEnableForce(File file, String mimeType, String sceneKey, boolean enableForceUploadFile);
49
50
51 /**
52 * 下载文件
53 *
54 * @param url 文件url
55 * @param thumb 缩略图配置
56 * @param path 下载保存路径
57 * @return AbortableFuture
58 */
59 AbortableFuture<Void> download(String url, NosThumbParam thumb, String path);
60
61
62 /**
63 * 通过安全链接下载文件
64 *
65 * @param url 文件url
66 * @param path 下载保存路径
67 * @return AbortableFuture
68 */
69 AbortableFuture<Void> downloadFileSecure(String url, String path);
70
71
72 /**
73 * 将文件url 转换成CDN 加速url ,如果不支持,返回原链接
74 *
75 * @param url 原始链接
76 * @return CDN 加速链接,如果不支持,返回原链接
77 */
78 String convertDownloadUrlToCDNUrl(String url);
79
80
81 /**
82 * 针对开启了NOS 文件安全功能的用户,可能通过短链获取原始链接,注意保护原始链接不要外泄
83 *
84 * @param shortUrl 短链 ,如果参数不是长链,返回414
85 * @return InvocationFuture
86 */
88
89
90 /**
91 * 针对开启了NOS 文件安全功能的用户,可能通过短链获取原始链接,注意保护原始链接不要外泄
92 *
93 * @param roomId 聊天室id
94 * @param shortUrl 短链 ,如果参数不是长链,返回414
95 * @return InvocationFuture
96 */
97 InvocationFuture<String> getOriginUrlFromShortUrl(String roomId, String shortUrl);
98
99}
向NOS请求下载缩略图的参数
可中断操作的调用跟踪接口。
AbortableFuture< String > upload(File file, String mimeType)
使用默认的nos scene NimNosSceneKeyConstant#NIM_DEFAULT_PROFILE上传文件 参考 uploadAtScene(File,...
InvocationFuture< String > getOriginUrlFromShortUrl(String shortUrl)
针对开启了NOS 文件安全功能的用户,可能通过短链获取原始链接,注意保护原始链接不要外泄
String convertDownloadUrlToCDNUrl(String url)
将文件url 转换成CDN 加速url ,如果不支持,返回原链接
AbortableFuture< String > uploadEnableForce(File file, String mimeType, String sceneKey, boolean enableForceUploadFile)
与upload(File, String)功能一样,不过指定了上传文件时用的nos scene 以及是否需要强制重新上传文件
AbortableFuture< Void > downloadFileSecure(String url, String path)
通过安全链接下载文件
AbortableFuture< Void > download(String url, NosThumbParam thumb, String path)
下载文件
InvocationFuture< String > getOriginUrlFromShortUrl(String roomId, String shortUrl)
针对开启了NOS 文件安全功能的用户,可能通过短链获取原始链接,注意保护原始链接不要外泄
AbortableFuture< String > uploadAtScene(File file, String mimeType, String sceneKey)
与upload(File, String)功能一样,不过指定了上传文件时用的nos scene