NIMSDK-AOS  9.19.0
NosConfig.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.misc.model;
2 
3 import android.text.TextUtils;
4 
5 import androidx.annotation.NonNull;
6 
7 public class NosConfig {
8  /** nos的桶名 nim*/
9  final private String bucket;
10  /** cdn下载域名 https://imtest.netease.im/chat-cdn*/
11  final private String cdnDomain;
12  /** 失效时间戳,单位毫秒,如:31104000 -1*/
13  final private long deadline;
14  /** objectName匹配前缀,端侧可根据字符串匹配获取ObjectName来拼接替换cdn域名 */
15  final private String objectNamePrefix;
16 
17  public NosConfig(String bucket, @NonNull String cdnDomain, long deadline, String objectNamePrefix) {
18  this.bucket = bucket;
19  this.cdnDomain = cdnDomain;
20  this.deadline = deadline;
21  this.objectNamePrefix = objectNamePrefix;
22  }
23 
24  public String getBucket() {
25  return bucket;
26  }
27 
28  public String getCdnDomain() {
29  return cdnDomain;
30  }
31 
32  public long getDeadline() {
33  return deadline;
34  }
35 
36  public String getObjectNamePrefix() {
37  return objectNamePrefix;
38  }
39 
40  public boolean isValid() {
41  return deadline != 0 && !TextUtils.isEmpty(cdnDomain);
42  }
43 
44  public boolean isValidForever() {
45  return deadline == -1;
46  }
47 
48  @Override
49  public String toString() {
50  return "NosConfig{" +
51  "bucket='" + bucket + '\'' +
52  ", cdnDomain='" + cdnDomain + '\'' +
53  ", deadline=" + deadline +
54  ", objectNamePrefix='" + objectNamePrefix + '\'' +
55  '}';
56  }
57 }
NosConfig(String bucket, @NonNull String cdnDomain, long deadline, String objectNamePrefix)
Definition: NosConfig.java:17