鳯华 v4.0.0版本的 MD5 值为:e66eea5d0a772ef117f7e252dfbb1dfc

以下内容为反编译后的 LinkingVodManager.java 源代码,内容仅作参考


package com.qiniu.linking;

import com.qiniu.common.Constants;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Client;
import com.qiniu.http.Response;
import com.qiniu.linking.model.SaveasReply;
import com.qiniu.linking.model.SegmentListing;
import com.qiniu.util.Auth;
import com.qiniu.util.Json;
import com.qiniu.util.StringMap;
import com.qiniu.util.UrlSafeBase64;
import com.tencent.qcloud.tim.uikit.utils.TUIKitConstants;
public class LinkingVodManager {
    private final Auth auth;
    private final Client client;
    private final String host;

    public LinkingVodManager(Auth auth) {
        this(auth, "http://linking.qiniuapi.com");
    }

    public SegmentListing querySegments(String str, String str2, long j9, long j10, String str3, int i9) throws QiniuException {
        String format = String.format("%s/v1/apps/%s/devices/%s/vod/segments?%s", this.host, str, UrlSafeBase64.encodeToString(str2), new StringMap().putNotEmpty("marker", str3).putWhen("start", Long.valueOf(j9), j9 > 0).putWhen("end", Long.valueOf(j10), j10 > 0).putWhen(TUIKitConstants.Selection.LIMIT, Integer.valueOf(i9), i9 > 0).formString());
        Response response = this.client.get(format, this.auth.authorizationV2(format, "GET", null, null));
        if (response.isOK()) {
            SegmentListing segmentListing = (SegmentListing) response.jsonToObject(SegmentListing.class);
            response.close();
            return segmentListing;
        }
        throw new QiniuException(response);
    }

    public SaveasReply saveAs(String str, String str2, long j9, long j10, String str3, String str4) throws QiniuException {
        String encodeToString = UrlSafeBase64.encodeToString(str2);
        StringMap putNotEmpty = new StringMap().put("start", Long.valueOf(j9)).put("end", Long.valueOf(j10)).putNotEmpty("fname", str3).putNotEmpty("format", str4);
        String format = String.format("%s/v1/apps/%s/devices/%s/vod/saveas", this.host, str, encodeToString);
        byte[] bytes = Json.encode(putNotEmpty).getBytes(Constants.UTF_8);
        Response post = this.client.post(format, bytes, this.auth.authorizationV2(format, "POST", bytes, "application/json"), "application/json");
        if (post.isOK()) {
            SaveasReply saveasReply = (SaveasReply) post.jsonToObject(SaveasReply.class);
            post.close();
            return saveasReply;
        }
        throw new QiniuException(post);
    }

    public LinkingVodManager(Auth auth, String str) {
        this(auth, str, new Client());
    }

    public LinkingVodManager(Auth auth, String str, Client client) {
        this.auth = auth;
        this.host = str;
        this.client = client;
    }
}