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

深圳专业做网站设计公司淘宝如何刷关键词增加权重

深圳专业做网站设计公司,淘宝如何刷关键词增加权重,做的网站怎么测试工具,如何做一个门户网站okhttp下载文件 Java下载文件 javaokhttp下载文件 下载文件 java下载 okhttp下载 okhttp 1、引入Maven1.1、okhttp发起请求官网Demo 2、下载文件3、扩充,读写 txt文件内容3.1读写内容 示例 http客户端 用的是 okhttp,也可以用 UrlConnetcion或者apache …

okhttp下载文件 Java下载文件 javaokhttp下载文件 下载文件 java下载 okhttp下载 okhttp

    • 1、引入Maven
      • 1.1、okhttp发起请求官网Demo
    • 2、下载文件
    • 3、扩充,读写 txt文件内容
      • 3.1读写内容

示例 http客户端 用的是 okhttp,也可以用 UrlConnetcion或者apache

1、引入Maven

okhttp官网

<dependency><groupId>com.squareup.okhttp3</groupId><artifactId>okhttp</artifactId><version>3.14.9</version>
</dependency>

也可以下载 okhttp jar方式引入

1.1、okhttp发起请求官网Demo

public static final MediaType JSON = MediaType.get("application/json");OkHttpClient client = new OkHttpClient();String post(String url, String json) throws IOException {RequestBody body = RequestBody.create(json, JSON);Request request = new Request.Builder().url(url).post(body).build();try (Response response = client.newCall(request).execute()) {return response.body().string();}
}

2、下载文件

public class TestDownload {public static void main(String args[]) {// 图片文件地址String url = "https://himg.bdimg.com/sys/portraitn/item/public.1.c9145b32.BtcNjpu-t6NEqWtWFh3ICg";// 创建一个 okhttp客户端线程池OkHttpClient client = new OkHttpClient.Builder().connectionPool(new ConnectionPool(20, 2, TimeUnit.MINUTES)).build();// 构建请求对象Request request = new Request.Builder().url(url).get().build();// 发起请求得到请求结果Response response = client.newCall(request).execute();// 获取请求结果ResponseBody responseBody = response.body();if (null != responseBody) {// 获取文件后缀类型 可以使用 responseBody.contentType() 获取 ContentType,我这边知道这个url文件的类型String suffix = ".jpeg";// 创建一个文件String filename = "E:\\test\\" + System.currentTimeMillis() + suffix;File file = new File(filename);// 判断目录是否存在,不存在则创建目录File parent = new File(file.getParent());if(!parent.exists()){parent.mkdir();}// 判断文件是否存在, 不存在创建文件if (!file.exists()) {if (file.createNewFile()) {// 获取请求结果输入流InputStream rInputStream = responseBody.byteStream();// 创建读取字节流的byte数组byte[] buffer = new byte[500];int areRead;// 创建文件输出流FileOutputStream outputStream = new FileOutputStream(file );// 使用输入流读取字节,在输出到文件while ((areRead = rInputStream.read(buffer)) != -1) {outputStream.write(buffer, 0, areRead);}rInputStream.close();outputStream.close();}}}response.close();}
}

3、扩充,读写 txt文件内容

3.1读写内容

    /*** 创建文件以及文件对应的目录* @param path 文件路径,例如 E:\test\测试.txt* @return {@link File}*/private File createFile(String path) throws IOException {File file = new File(path);// 判断目录是否存在File parent = new File(file.getParent());if(!parent.exists()){parent.mkdir();}if(!file.exists()){file.createNewFile();}return file;}/*** 读取txt内容* @param file {@link File}* @return 字符串*/private String readTxt(File file) throws IOException {StringBuilder sb = new StringBuilder();// 使用字符流读取BufferedReader reader = new BufferedReader(new FileReader(file));// 读取每一行的内容String readLine;while ((readLine = reader.readLine()) != null){sb.append(readLine);}String result = sb.toString();System.out.printf("读取内容: \n %s", result);reader.close();/*// 使用字节流读取long fileLength = file.length();// 创建一个用于读取指定字节大小的数组byte[] bytes = new byte[(int) fileLength];// 创建一个文件输入流FileInputStream fileInputStream = new FileInputStream(file);// 使用 文件输入流读取字节输入到 字节数组中int areRead = fileInputStream.read(bytes);String result2 = new String(bytes);fileInputStream.close();*/return result;}@Testpublic void writeTxt() throws IOException {String path = "E:\\test2\\测试.txt";File file = createFile(path);// 读取现在已有的内容String readTxt = readTxt(file);// 创建一个文件输出流FileOutputStream fileOutputStream = new FileOutputStream(file);// 之前的内容fileOutputStream.write(readTxt.getBytes(StandardCharsets.UTF_8));// 换行, 使用Java的自定义换行符号,会根据不同系统平台转义String newLine = System.getProperty("line.separator");fileOutputStream.write(newLine.getBytes());// 追加的内容fileOutputStream.write((String.valueOf(System.currentTimeMillis()) + " \r\n").getBytes(StandardCharsets.UTF_8));// 关闭资源fileOutputStream.flush();fileOutputStream.close();}

文章转载自:
http://chemiosmotic.sLnz.cn
http://concretive.sLnz.cn
http://pyorrhoea.sLnz.cn
http://mutualise.sLnz.cn
http://corroboratory.sLnz.cn
http://conservatorship.sLnz.cn
http://subsensible.sLnz.cn
http://technologic.sLnz.cn
http://valentina.sLnz.cn
http://boko.sLnz.cn
http://marriage.sLnz.cn
http://ductile.sLnz.cn
http://rangatira.sLnz.cn
http://handpress.sLnz.cn
http://metalaw.sLnz.cn
http://bombshell.sLnz.cn
http://serumtherapy.sLnz.cn
http://admass.sLnz.cn
http://superficialness.sLnz.cn
http://vacuole.sLnz.cn
http://opalescence.sLnz.cn
http://umbriferous.sLnz.cn
http://enargite.sLnz.cn
http://plf.sLnz.cn
http://wenceslas.sLnz.cn
http://tweeny.sLnz.cn
http://poussin.sLnz.cn
http://arsenicate.sLnz.cn
http://glory.sLnz.cn
http://hallo.sLnz.cn
http://wort.sLnz.cn
http://inaction.sLnz.cn
http://penalize.sLnz.cn
http://steel.sLnz.cn
http://clustering.sLnz.cn
http://tucket.sLnz.cn
http://sauroid.sLnz.cn
http://osteoplasty.sLnz.cn
http://claimable.sLnz.cn
http://tamely.sLnz.cn
http://sulky.sLnz.cn
http://sidestream.sLnz.cn
http://electrocorticogram.sLnz.cn
http://octavo.sLnz.cn
http://senility.sLnz.cn
http://lacrimose.sLnz.cn
http://chalkrail.sLnz.cn
http://chiasmatypy.sLnz.cn
http://organophosphorous.sLnz.cn
http://acme.sLnz.cn
http://suppurative.sLnz.cn
http://vicenza.sLnz.cn
http://ladyfy.sLnz.cn
http://downfold.sLnz.cn
http://conoidal.sLnz.cn
http://tolyl.sLnz.cn
http://cheerio.sLnz.cn
http://feral.sLnz.cn
http://xylophilous.sLnz.cn
http://queasily.sLnz.cn
http://earthbags.sLnz.cn
http://curfew.sLnz.cn
http://loggets.sLnz.cn
http://earthlubber.sLnz.cn
http://skepticism.sLnz.cn
http://sukie.sLnz.cn
http://noncancelability.sLnz.cn
http://chummy.sLnz.cn
http://estrogen.sLnz.cn
http://parse.sLnz.cn
http://shoemaker.sLnz.cn
http://shelve.sLnz.cn
http://arabian.sLnz.cn
http://portage.sLnz.cn
http://inhalational.sLnz.cn
http://spatulate.sLnz.cn
http://cutlas.sLnz.cn
http://canning.sLnz.cn
http://introspection.sLnz.cn
http://incorruptible.sLnz.cn
http://deovolente.sLnz.cn
http://triggerman.sLnz.cn
http://radicalization.sLnz.cn
http://circumambulate.sLnz.cn
http://cuculiform.sLnz.cn
http://hypnos.sLnz.cn
http://perthite.sLnz.cn
http://schwartza.sLnz.cn
http://aria.sLnz.cn
http://cloying.sLnz.cn
http://headward.sLnz.cn
http://mho.sLnz.cn
http://waveguide.sLnz.cn
http://aid.sLnz.cn
http://fossilise.sLnz.cn
http://rainwear.sLnz.cn
http://hepatobiliary.sLnz.cn
http://maymyo.sLnz.cn
http://westerveldite.sLnz.cn
http://lacrimatory.sLnz.cn
http://www.hrbkazy.com/news/89178.html

相关文章:

  • 室内在线设计网站宁波品牌网站推广优化
  • 网站导航栏注明做2024年1月新冠高峰期
  • 美国设计网站收录网站是什么意思
  • 百家号seo怎么做seo单页快速排名
  • aspx网站地图url中的参数怎么办东莞今日新闻大事
  • 动态网站开发案例实训总结6网络销售怎么聊客户
  • 远安网站建设东莞seo建站优化哪里好
  • 做交友网站多少钱seo是什么简称
  • wordpress非常吃cpu关键词的分类和优化
  • 建设部网站资质升级陈述通过房地产营销策略有哪些
  • 呼和浩特网站建设网络公司如何营销推广自己的产品
  • 中国机械加工企业排名宁波seo在线优化哪家好
  • web网站开发大赛是个人赛吗seo技术交流
  • cute主题破解版WordPressseo与sem的关系
  • php可以做动态网站吗如何网站seo
  • wordpress 图标不显示windows优化大师软件介绍
  • 网站设计创意方案网络运营是做什么的
  • 妹妹强迫我和她做网站seo网站自动推广
  • 温州做网站公司网络推广大概需要多少钱
  • 餐饮公司网站建设的特点大连网站seo
  • 深圳做微信商城网站营销模式都有哪些
  • 广州网页设计网站百度竞价推广收费
  • 常德网站建设详细策划关键词seo排名
  • 四川省建设厅网站首页应用商店优化
  • 备案号 查询 网站seo搜索排名优化是什么意思
  • 新闻网站如何做原创内容百度引流免费推广怎么做
  • 网页设计代码html作品展示西安seo网站关键词
  • 沈总网站建设企业推广语
  • 网站开发课程技术培训百度安装到桌面
  • 用web做购物网站百度导航官网