资源简介
一个基于Java的WebSocket爬虫示例,用于模拟客户端请求服务器,建立WebSocket连接,抓取对方数据,测试为某直播网站。运行时需要获取一个正在直播的网页地址,运行项目下的YizhiboView.java类。
代码片段和文件信息
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License Version 2.0 (the
“License“); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing
software distributed under the License is distributed on an
“AS IS“ BASIS WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.util.Properties;
public class MavenWrapperDownloader {
/**
* Default URL to download the maven-wrapper.jar from if no ‘downloadUrl‘ is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
“https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar“;
/**
* Path to the maven-wrapper.properties file which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
“.mvn/wrapper/maven-wrapper.properties“;
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
“.mvn/wrapper/maven-wrapper.jar“;
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = “wrapperUrl“;
public static void main(String args[]) {
System.out.println(“- Downloader started“);
File baseDirectory = new File(args[0]);
System.out.println(“- Using base directory: “ + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL url);
} catch (IOException e) {
Syst
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-04-11 18:57 CrawSocketDemo\
文件 303 2019-04-11 17:30 CrawSocketDemo\.gitignore
目录 0 2019-04-11 18:57 CrawSocketDemo\.idea\
文件 833 2019-04-11 17:31 CrawSocketDemo\.idea\compiler.xm
文件 209 2019-04-11 17:31 CrawSocketDemo\.idea\encodings.xm
目录 0 2019-04-11 17:31 CrawSocketDemo\.idea\inspectionProfiles\
文件 274 2019-04-11 17:31 CrawSocketDemo\.idea\inspectionProfiles\Project_Default.xm
目录 0 2019-04-11 18:33 CrawSocketDemo\.idea\libraries\
文件 568 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__ch_qos_logback_logback_classic_1_2_3.xm
文件 547 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__ch_qos_logback_logback_core_1_2_3.xm
文件 513 2019-04-11 18:33 CrawSocketDemo\.idea\libraries\Maven__cn_hutool_hutool_all_4_3_2.xm
文件 522 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 644 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 595 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 623 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 674 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 688 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 729 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__com_fasterxm
文件 546 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__com_jayway_jsonpath_json_path_2_4_0.xm
文件 700 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xm
文件 543 2019-04-11 17:34 CrawSocketDemo\.idea\libraries\Maven__commons_codec_commons_codec_1_11.xm
文件 611 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__javax_annotation_javax_annotation_api_1_3_2.xm
文件 611 2019-04-11 17:33 CrawSocketDemo\.idea\libraries\Maven__javax_validation_validation_api_2_0_1_Final.xm
文件 455 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__junit_junit_4_12.xm
文件 536 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__net_bytebuddy_byte_buddy_1_9_12.xm
文件 578 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__net_bytebuddy_byte_buddy_agent_1_9_12.xm
文件 542 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__net_minidev_accessors_smart_1_2.xm
文件 507 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__net_minidev_json_smart_2_3.xm
文件 577 2019-04-11 17:34 CrawSocketDemo\.idea\libraries\Maven__org_apache_httpcomponents_httpclient_4_5_2.xm
文件 570 2019-04-11 17:34 CrawSocketDemo\.idea\libraries\Maven__org_apache_httpcomponents_httpcore_4_4_11.xm
文件 573 2019-04-11 17:31 CrawSocketDemo\.idea\libraries\Maven__org_apache_logging_log4j_log4j_api_2_11_2.xm
............此处省略92个文件信息
- 上一篇:关于Android的外文文献
- 下一篇:java小说网站爬虫
相关资源
- java小说网站爬虫
- java算法为蓝桥杯做准备
- 医院管理系统——数据库课程设计
- java打字母游戏
- java实现的一个小小画图板的开发
- Java实现弹球游戏
- 明日科技,java web视频共享,光盘资料
- java调用C#封装的dll(jnacom)
- 毕向东Java教程全套包含35天.rar
- java 图书管理系统源码
- 基于java的八数码DFS搜索算法以及界面
- 决策树Java代码实现
- ownCloud java使用curl上传文件
- java 实现指数平滑 包含1-3次
- RBF神经网络java 源代码
- 李兴华老师视频Java&web;,2015版
- mysql-connector-java-5.0.8-bin 连接mysql数据
- JavaEE就业webSSHSSMJava仿在线教育网站
- 优效学院--JAVA高级架构师(30.85G).
- javaswf播放flash的类库
- 基于java的学生成绩管理程序
- 《JAVA程序设计》期末考试试题汇总及
- java实现网络五子棋
- mysql-connector-java-5.1.47.jar
- JavaFX编写学生管理系统利用scene buil
- java多线程实现乒乓球双打
- java docx 转 html XHTMLOptions等方法jar包
- JSONParser.java
- java版本的word2vec
- sql语句转为java的StringBuilder
评论
共有 条评论