当前位置: 首页 > news >正文

网页设计规范2018seo收录排名

网页设计规范2018,seo收录排名,具有价值的响应式网站,室内设计师证需要学哪些课程背景&#xff1a;最近做一个腾讯 cos 桶 文件的读写与本地数据库查询等操作 Retrofit 中文件下载的可以添加 Streaming StreamingGETObservable<ResponseBody> downloadCosFile(Url String downloadUrl);Streaming 的作用&#xff1a; 注解通常用于指示Retrofit或其他HTT…

背景:最近做一个腾讯 cos 桶 文件的读写与本地数据库查询等操作
Retrofit 中文件下载的可以添加 @Streaming

    @Streaming@GETObservable<ResponseBody> downloadCosFile(@Url String downloadUrl);

@Streaming 的作用:
注解通常用于指示Retrofit或其他HTTP请求库将响应的内容作为流式数据而不是将其全部加载到内存中。这对于处理大文件或流式传输非常有用,因为它可以减少内存占用并提高性能。

HttpCenter.getInstance().requestResponse(HttpCenter.getInstance().getApi().downloadCosFile(fileDownloadPath), new HttpObserver<ResponseBody>(ApiService.GET_COS_FILE_INFO) {@Overrideprotected void onFailure(ApiException e) {NLog.i(TAG, "onFailure:  cos 文件 请求失败" + e.getMessage());callBack.onResult(null);}@Overrideprotected void onSuccess(ResponseBody responseBody) {NLog.i(TAG, "onSuccess:  cos 文件 请求成功");// 下载文件AppExecutors.autoExecute(() -> {// 读入请求体的输入流InputStream inputStream = responseBody.byteStream();// 指定文件全路径-》 引申获取Android 几种路径的方式String zipFilePath = "fileObsolutePath" File outputFile = new File(zipFilePath); // 保存到应用的私有目录try (FileOutputStream outputStream = new FileOutputStream(outputFile)) {byte[] buffer = new byte[4 * 1024];int read;while ((read = inputStream.read(buffer)) != -1) {outputStream.write(buffer, 0, read);}outputStream.flush();NLog.i(TAG, "onSuccess: 文件写入成功");String unZipFileDir;ZipUtils.UnZipFolder(outputFile.getAbsolutePath(), unZipFileDir, unZipPathList -> {if (unZipPathList != null && unZipPathList.size() > 0) {// 每个压缩文件下只有一个文件,所以直接取第一个解压文件路径NLog.i(TAG, "onSuccess: 解压成功 " + unZipPathList.get(0));callBack.onResult(unZipPathList.get(0));} else {callBack.onResult(null);}});// 删除所有解析数据deleteDirectory(FileUtil.getSecondFolder(DOWNLOAD_COS_DIR));} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}});}
}

ZipUtils.java 解压文件

public static void UnZipFolder(String zipFileString, String outPathString, ICommListener<List<String>> iCommListener) throws IOException {ZipInputStream inZip = new ZipInputStream(new FileInputStream(zipFileString));ZipEntry zipEntry;String szName = "";List<String> unZipPathList = new ArrayList<>();while ((zipEntry = inZip.getNextEntry()) != null) {szName = zipEntry.getName();NLog.i(TAG, "UnZipFolder: zipEntry " + szName);if (zipEntry.isDirectory()) {NLog.i(TAG, "UnZipFolder: 解压目录 ");//获取部件的文件夹名szName = szName.substring(0, szName.length() - 1);File folder = new File(outPathString + File.separator + szName);folder.mkdirs();} else {NLog.i(TAG, "UnZipFolder: 解压文件 ");String unZipPath = outPathString + File.separator + szName;File file = new File(unZipPath);if (!file.exists()) {file.getParentFile().mkdirs();file.createNewFile();}// 获取文件的输出流FileOutputStream out = new FileOutputStream(file);int len;byte[] buffer = new byte[1024];// 读取(字节)字节到缓冲区while ((len = inZip.read(buffer)) != -1) {// 从缓冲区(0)位置写入(字节)字节out.write(buffer, 0, len);out.flush();}out.close();unZipPathList.add(unZipPath);NLog.i(TAG, "UnZipFolder: 解压文件写入完成 ");}}inZip.close();iCommListener.onResult(unZipPathList);NLog.i(TAG, "UnZipFolder: 解压结束");}

删除目录

 public static boolean deleteDir(final File dir) {if (dir == null) return false;// dir doesn't exist then return trueif (!dir.exists()) return true;// dir isn't a directory then return falseFile[] files = dir.listFiles();if (files != null && files.length != 0) {for (File file : files) {if (file.isFile()) {if (!file.delete()) return false;} else if (file.isDirectory()) {if (!deleteDir(file)) return false;}}}return dir.delete();}
http://www.shuangfujiaoyu.com/news/19919.html

相关文章:

  • 模板网站免费下载识图搜索在线 照片识别
  • strikingly建站怎么样什么都不懂能去干运营吗
  • 网站哪里可以做搜狗站长平台验证网站
  • wordpress+中文站百度网站推广电话
  • 新手站长做游戏网站好吗房地产网站模板
  • 做网站的公司一般怎么培训销售如何创建自己的小程序
  • 在线代理浏览器网站网站的营销策略
  • 网站做线上销售seo排名优化关键词
  • 有网站建设需求的网站网站怎么优化到首页
  • 海外做bt种子网站百度大数据平台
  • 网站建设与维护 发票湘潭网站设计外包服务
  • 永嘉网站制作哪家好seo运营是做什么的
  • 无锡网站建设动态樱桃bt磁力天堂
  • 建设一个公司网站需要多少钱河南整站百度快照优化
  • 网站推广费用怎么做分录百度招商客服电话
  • php网站开发教材如何网络营销自己的产品
  • 区域销售网站什么做百度的网页地址
  • b2c电子商务模式指的是日照网站优化公司
  • 付运费送东西的网站怎么做百度推广官网登录
  • php做网站商城系统怎么样内江seo
  • 网站设计大概多少钱营销策略ppt
  • 5118站长平台网站快速排名优化价格
  • 建设网站建设安全培训平台seo营销推广服务公司
  • 网页设计与网站建设考试seo百度站长工具查询
  • 公司网站怎么做备案信息国内seo公司
  • 网站建设的收费百度推广关键词
  • 黄酒的电商网页设计网站深圳市seo点击排名软件价格
  • wordpress版本可以恢复旧版本东莞网络优化哪家好
  • 公司建设一个网站有什么好处百度搜索引擎的网址
  • 中国网站制作企业排行榜金华seo全网营销