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

如何做网站的外链百度一下网页搜索

如何做网站的外链,百度一下网页搜索,旅游网站组织结构图怎么做,成都网站app开发文章目录 Pre效果实现git clone编译测试程序将ip2region.xdb放到指定目录使用改进最终效果 Pre OpenSource - Ip2region 离线IP地址定位库和IP定位数据管理框架 Ip2region - xdb java 查询客户端实现 效果 最终效果 实现 git clone git clone https://github.com/lionsou… 文章目录 Pre效果实现git clone编译测试程序将ip2region.xdb放到指定目录使用改进最终效果 Pre OpenSource - Ip2region 离线IP地址定位库和IP定位数据管理框架 Ip2region - xdb java 查询客户端实现 效果 最终效果 实现 git clone git clone https://github.com/lionsoul2014/ip2region.git编译测试程序 cd binding/java/ mvn compile package然后会在当前目录的 target 目录下得到一个 ip2region-{version}.jar 的打包文件。 将ip2region.xdb放到指定目录 使用 改进 // Copyright 2022 The Ip2Region Authors. All rights reserved. // Use of this source code is governed by a Apache2.0-style // license that can be found in the LICENSE file. // Author Lion chenxin619315gmail.com // Date 2022/06/23package org.lionsoul.ip2region;import org.lionsoul.ip2region.xdb.Searcher;import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.util.Scanner; import java.util.concurrent.TimeUnit;public class SearchTest {public static void printHelp(String[] args) {System.out.print(ip2region xdb searcher\n);System.out.print(java -jar ip2region-{version}.jar [command] [command options]\n);System.out.print(Command: \n);System.out.print( search search input test\n);System.out.print( bench search bench test\n);}public static Searcher createSearcher(String dbPath, String cachePolicy) throws IOException {if (file.equals(cachePolicy)) {return Searcher.newWithFileOnly(dbPath);} else if (vectorIndex.equals(cachePolicy)) {byte[] vIndex Searcher.loadVectorIndexFromFile(dbPath);return Searcher.newWithVectorIndex(dbPath, vIndex);} else if (content.equals(cachePolicy)) {byte[] cBuff Searcher.loadContentFromFile(dbPath);return Searcher.newWithBuffer(cBuff);} else {throw new IOException(invalid cache policy cachePolicy , options: file/vectorIndex/content);}}public static void searchTest(String[] args) throws IOException {String dbPath , cachePolicy vectorIndex;for (final String r : args) {if (r.length() 5) {continue;}if (r.indexOf(--) ! 0) {continue;}int sIdx r.indexOf();if (sIdx 0) {System.out.printf(missing for args pair %s\n, r);return;}String key r.substring(2, sIdx);String val r.substring(sIdx 1);// System.out.printf(key%s, val%s\n, key, val);if (db.equals(key)) {dbPath val;} else if (cache-policy.equals(key)) {cachePolicy val;} else {System.out.printf(undefined option %s\n, r);return;}}if (dbPath.length() 1) {System.out.print(java -jar ip2region-{version}.jar search [command options]\n);System.out.print(options:\n);System.out.print( --db string ip2region binary xdb file path\n);System.out.print( --cache-policy string cache policy: file/vectorIndex/content\n);return;}Searcher searcher createSearcher(dbPath, cachePolicy);Scanner scanner new Scanner(System.in);String line scanner.nextLine();try {String region searcher.search(line.trim());System.out.printf(ip: %s , region: %s\n, line, region);} catch (Exception e) {System.out.printf({err: %s, ioCount: %d}\n, e, searcher.getIOCount());}searcher.close();}public static void benchTest(String[] args) throws IOException {String dbPath , srcPath , cachePolicy vectorIndex;for (final String r : args) {if (r.length() 5) {continue;}if (r.indexOf(--) ! 0) {continue;}int sIdx r.indexOf();if (sIdx 0) {System.out.printf(missing for args pair %s\n, r);return;}String key r.substring(2, sIdx);String val r.substring(sIdx 1);if (db.equals(key)) {dbPath val;} else if (src.equals(key)) {srcPath val;} else if (cache-policy.equals(key)) {cachePolicy val;} else {System.out.printf(undefined option %s\n, r);return;}}if (dbPath.length() 1 || srcPath.length() 1) {System.out.print(java -jar ip2region-{version}.jar bench [command options]\n);System.out.print(options:\n);System.out.print( --db string ip2region binary xdb file path\n);System.out.print( --src string source ip text file path\n);System.out.print( --cache-policy string cache policy: file/vectorIndex/content\n);return;}Searcher searcher createSearcher(dbPath, cachePolicy);long count 0, costs 0, tStart System.nanoTime();String line;final Charset charset Charset.forName(utf-8);final FileInputStream fis new FileInputStream(srcPath);final BufferedReader reader new BufferedReader(new InputStreamReader(fis, charset));while ((line reader.readLine()) ! null) {String l line.trim();String[] ps l.split(\\|, 3);if (ps.length ! 3) {System.out.printf(invalid ip segment %s\n, l);return;}long sip;try {sip Searcher.checkIP(ps[0]);} catch (Exception e) {System.out.printf(check start ip %s: %s\n, ps[0], e);return;}long eip;try {eip Searcher.checkIP(ps[1]);} catch (Exception e) {System.out.printf(check end ip %s: %s\n, ps[1], e);return;}if (sip eip) {System.out.printf(start ip(%s) should not be greater than end ip(%s)\n, ps[0], ps[1]);return;}long mip (sip eip) 1;for (final long ip : new long[]{sip, (sip mip) 1, mip, (mip eip) 1, eip}) {long sTime System.nanoTime();String region searcher.search(ip);costs System.nanoTime() - sTime;// check the region infoif (!ps[2].equals(region)) {System.out.printf(failed search(%s) with (%s ! %s)\n, Searcher.long2ip(ip), region, ps[2]);return;}count;}}reader.close();searcher.close();long took System.nanoTime() - tStart;System.out.printf(Bench finished, {cachePolicy: %s, total: %d, took: %ds, cost: %d μs/op}\n,cachePolicy, count, TimeUnit.NANOSECONDS.toSeconds(took),count 0 ? 0 : TimeUnit.NANOSECONDS.toMicros(costs / count));}public static void main(String[] args) {if (args.length 1) {printHelp(args);return;}if (search.equals(args[0])) {try {searchTest(args);} catch (IOException e) {System.out.printf(failed running search test: %s\n, e);}} else if (bench.equals(args[0])) {try {benchTest(args);} catch (IOException e) {System.out.printf(failed running bench test: %s\n, e);}} else {printHelp(args);}}} 重新编译 执行 最终效果 这样就可以愉快的在脚本中调用了 当然了启动java进程的过程相对还是比较耗时的这里仅提供一种思路
http://www.dnsts.com.cn/news/60316.html

相关文章:

  • 深圳网站制作880手机网站建站系统
  • 温州网站建设推广百度网页浏览器
  • 地区性门户网站是什么意思网站内容包括哪些
  • 手机网站怎么打开管理网站
  • 广州市外贸网站建设企业哪些网站是响应式的
  • 外贸淘宝网站建设智能网站建设软件有哪些
  • wordpress你访问的网站不存在wordpress 我爱水煮鱼
  • 南宁网站建设找哪家好苏州知名网站建设建站公司
  • 公司网站一般用什么软件做做任务送科比网站
  • 酒业公司网站模板wordpress主题在线检测工具
  • 怎么做不花钱的网站做黑彩网站赚钱吗
  • 招商银行官网首页 网站餐饮logo免费设计
  • 个人网站建设大全厦门做网站推广
  • 海南省交通建设局网站东莞市保安公司排名
  • 定制公司网站软件开发就业前景走向
  • 网站制作的服务商wordpress 文章发布失败
  • 包头网站建设设计网络优化公司哪家好
  • 做网站堵怕犯法吗政务网站建设办法
  • php做网站需要啥技术网站费用构成
  • 网页设计怎么建立网站化妆品网站建设说明
  • 做网站优化的好处网站制作哪家好
  • 正在运营的网站被注销备案怎么办南京seo关键词排名
  • 商城网站数据库编写网站程序
  • 做网站哪种编程语言好wordpress伪静态规则
  • 沈阳网站推广排名方案网站开发记什么科目
  • 南京网站优化公司排名青锐成长计划网站开发过程
  • 建设网站需要多少钱搭建一个小程序需要多少钱
  • vps网站如何设置缓存短视频推广策划方案模板
  • 网站建设步骤列表图片手机网站制作优化
  • 公司如何登录网站做就业登记虚拟主机 域名 和网站关系