如何用框android-content-sdk(notV2)获取缩略图

时间:2015-10-06 10:48:04

标签: android api sdk box

有一种方法可以使用新的android-content-sdk获取缩略图? 我在文档和方法中没有看到任何内容: https://github.com/box/box-android-sdk

感谢。

1 个答案:

答案 0 :(得分:0)

有两种方法可以返回请求:

/**
     * Gets a request that downloads a thumbnail to a target file
     *
     * @param target    target file to download thumbnail to
     * @param fileId    id of file to download the thumbnail of
     * @return  request to download a thumbnail to a target file
     * @throws IOException
     */
    public BoxRequestsFile.DownloadThumbnail getDownloadThumbnailRequest(File target, String fileId) throws IOException{
        if (!target.exists()){
            throw new FileNotFoundException();
        }
        BoxRequestsFile.DownloadThumbnail request = new BoxRequestsFile.DownloadThumbnail(target, getThumbnailFileDownloadUrl(fileId),mSession);
        return request;
    }

    /**
     * Gets a request that downloads the given file thumbnail to the provided outputStream. Developer is responsible for closing the outputStream provided.
     *
     * @param outputStream outputStream to write file contents to.
     * @param fileId the file id to download.
     * @return  request to download a file thumbnail
     */
    public BoxRequestsFile.DownloadThumbnail getDownloadThumbnailRequest(OutputStream outputStream, String fileId) {
        BoxRequestsFile.DownloadThumbnail request = new BoxRequestsFile.DownloadThumbnail(outputStream, getThumbnailFileDownloadUrl(fileId),mSession);
        return request;
    }