导航菜单

页面标题

页面副标题

新暖心缘 v8.1.1 - LinkingVodManager.java 源代码

正在查看: 新暖心缘 v8.1.1 应用的 LinkingVodManager.java JAVA 源代码文件

本页面展示 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 j8, long j9, String str3, int i8) 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(j8), j8 > 0).putWhen("end", Long.valueOf(j9), j9 > 0).putWhen(TUIKitConstants.Selection.LIMIT, Integer.valueOf(i8), i8 > 0).formString());
        Response response = this.client.get(format, this.auth.authorizationV2(format, "GET", null, null));
        if (!response.isOK()) {
            throw new QiniuException(response);
        }
        SegmentListing segmentListing = (SegmentListing) response.jsonToObject(SegmentListing.class);
        response.close();
        return segmentListing;
    }

    public SaveasReply saveAs(String str, String str2, long j8, long j9, String str3, String str4) throws QiniuException {
        String encodeToString = UrlSafeBase64.encodeToString(str2);
        StringMap putNotEmpty = new StringMap().put("start", Long.valueOf(j8)).put("end", Long.valueOf(j9)).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()) {
            throw new QiniuException(post);
        }
        SaveasReply saveasReply = (SaveasReply) post.jsonToObject(SaveasReply.class);
        post.close();
        return saveasReply;
    }

    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;
    }
}