How to get thumbnails with box android-content-sdk (notV2)

坚强是说给别人听的谎言 提交于 2019-12-24 16:03:16

问题


There is a way to get the thumbnails with new box android-content-sdk? I don't see anything in the doc and methods: https://github.com/box/box-android-sdk

Thanks.


回答1:


There are two methods that return a request:

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


来源:https://stackoverflow.com/questions/32968067/how-to-get-thumbnails-with-box-android-content-sdk-notv2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!