1 Unstar Star 1 Fork 0

梁昊 / lqhaoNodeJS

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
第一个hexo spread retract

Clone or download
index.html 38.77 KB
Copy Edit Web IDE Raw Blame History
梁昊 authored 2020-07-25 19:47 . Site updated: 2020-07-25 19:46:50
<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>不蒸馒头争口气 - 一个有心的车主</title><meta name="description" content="万丈高楼平地起,一切承担靠地基"><meta name="author" content="laden"><meta name="copyright" content="laden"><meta name="format-detection" content="telephone=no"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://lqhao.gitee.io/"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin="crossorigin"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="preconnect" href="//zz.bdstatic.com"/><meta property="og:type" content="website"><meta property="og:title" content="不蒸馒头争口气"><meta property="og:url" content="http://lqhao.gitee.io/"><meta property="og:site_name" content="不蒸馒头争口气"><meta property="og:description" content="万丈高楼平地起,一切承担靠地基"><meta property="og:image" content="https://gitee.com/lqhao/img-bed/raw/master/img-page/04232036663275.jpg"><meta property="article:published_time" content="2020-07-25T11:45:19.315Z"><meta property="article:modified_time" content="2020-07-25T11:45:19.315Z"><meta name="twitter:card" content="summary"><script>var activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000')
}
}
var activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#fff')
}
}
var getCookies = function (name) {
const value = `; ${document.cookie}`
const parts = value.split(`; ${name}=`)
if (parts.length === 2) return parts.pop().split(';').shift()
}
var autoChangeMode = 'false'
var t = getCookies('theme')
if (autoChangeMode === '1') {
var isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
var isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
var isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
var now = new Date()
var hour = now.getHours()
var isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (Cookies.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
}
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
} else if (autoChangeMode === '2') {
now = new Date()
hour = now.getHours()
isNight = hour <= 6 || hour >= 18
if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
else if (t === 'light') activateLightMode()
else activateDarkMode()
} else {
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
}</script><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&amp;display=swap"><script>var GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: undefined,
translate: undefined,
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
bookmark: {
message_prev: '',
message_next: '键将本页加入书签'
},
runtime_unit: '',
runtime: true,
copyright: undefined,
ClickShowText: undefined,
medium_zoom: false,
fancybox: true,
Snackbar: undefined,
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
},
baiduPush: true,
highlightCopy: true,
highlightLang: true,
isPhotoFigcaption: false,
islazyload: true,
isanchor: false
}</script><script>var GLOBAL_CONFIG_SITE = {
isPost: false,
isHome: true,
isHighlightShrink: false,
isSidebar: false
}</script><noscript><style>
#nav {
opacity: 1
}
.justified-gallery img{
opacity: 1
}
</style></noscript><meta name="generator" content="Hexo 4.2.1"></head><body><div id="mobile-sidebar"><div id="menu_mask"></div><div id="mobile-sidebar-menus"><div class="mobile_author_icon"><img class="avatar-img" src="https://gitee.com/lqhao/img-bed/raw/master/img-page/04232036663275.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="mobile_post_data"><div class="mobile_data_item is-center"><div class="mobile_data_link"><a href="/archives/"><div class="headline">文章</div><div class="length_num">16</div></a></div></div><div class="mobile_data_item is-center"> <div class="mobile_data_link"><a href="/tags/"><div class="headline">标签</div><div class="length_num">20</div></a></div></div><div class="mobile_data_item is-center"> <div class="mobile_data_link"><a href="/categories/"><div class="headline">分类</div><div class="length_num">4</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div id="body-wrap"><header class="full_page" id="page-header" style="background-image: url(https://gitee.com/lqhao/img-bed/raw/master/img-page/index3.jpg)"><nav id="nav"><span class="pull-left" id="blog_name"><a class="blog_title" id="site-name" href="/">不蒸馒头争口气</a></span><span class="pull-right menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><span class="toggle-menu close"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="site-info"><h1 id="site_title">不蒸馒头争口气</h1><div id="site_subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=949132421@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll_down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout_page" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/07/25/2/" title="Java-JDBC连接池、JDBCTemplate"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-JDBC连接池、JDBCTemplate"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/25/2/" title="Java-JDBC连接池、JDBCTemplate">Java-JDBC连接池、JDBCTemplate</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-25 19:41:52"><i class="far fa-calendar-alt"></i>2020-07-25</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/%E8%BF%9E%E6%8E%A5%E6%B1%A0/">连接池</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/Template/">Template</a></span></div><div class="content">1. 数据库连接池
2. Spring JDBC : JDBC Template数据库连接池1. 概念:其实就是一个容器(集合),存放数据库连接的容器。
当系统初始化好后,容器被创建,容器中会申请一些连接对象,当用户来访问数据库时,从容器中获取连接对象,用户访问完之后,会将连接对象归还给容器。
2. 好处:
1. 节约资源
2. 用户访问高效
3. 实现:
1. 标准接口:DataSource javax.sql包下的
1. 方法:
* 获取连接:getConnection()
* 归还连接:Connection.close()。如果连接对象Connection是从连接池中获取的,那么调用Connection.close()方法,则不会再关闭连接了。而是归还连接
2. 一般我们不去实现它,有数据库厂商来实现
1. C3P0:数据库连接池技术
2. Druid:数据库连接池实现技术,由阿里巴巴提供的
4. C3P0:数据库连接池技 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/07/25/ckd1l6zch0000y4ndh8csb75o/" title="Java-JDBC"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-JDBC"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/25/ckd1l6zch0000y4ndh8csb75o/" title="Java-JDBC">Java-JDBC</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-25 19:40:18"><i class="far fa-calendar-alt"></i>2020-07-25</time></div><div class="content">
title: Java-JDBCdata: 2020-07-25 11:30:00tags: [Java,JDBC]id: 1category: Java
2. 1. JDBC基本概念
2. 快速入门
3. 对JDBC中各个接口和类详解JDBC:1. 概念:Java DataBase Connectivity Java 数据库连接, Java语言操作数据库
* JDBC本质:其实是官方(sun公司)定义的一套操作所有关系型数据库的规则,即接口。各个数据库厂商去实现这套接口,提供数据库驱动jar包。我们可以使用这套接口(JDBC)编程,真正执行的代码是驱动jar包中的实现类。
2. 快速入门:
* 步骤:
1. 导入驱动jar包 mysql-connector-java-5.1.37-bin.jar
1.复制mysql-connector-java-5.1.37-bin.jar到项目的libs目录下
2.右键--&gt;Add As Library
2. 注册驱动
3. ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/07/23/2/" title="MySQL-约束"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="MySQL-约束"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/23/2/" title="MySQL-约束">MySQL-约束</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-23 16:54:40"><i class="far fa-calendar-alt"></i>2020-07-23</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/MySQL/">MySQL</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/MySQL/">MySQL</a></span></div><div class="content">1. DQL:查询语句
1. 排序查询
2. 聚合函数
3. 分组查询
4. 分页查询
2. 约束
3. 多表之间的关系
4. 范式
5. 数据库的备份和还原DQL:查询语句1. 排序查询
* 语法:order by 子句
* order by 排序字段1 排序方式1 , 排序字段2 排序方式2...
* 排序方式:
* ASC:升序,默认的。
* DESC:降序。
* 注意:
* 如果有多个排序条件,则当前边的条件值一样时,才会判断第二条件。
2. 聚合函数:将一列数据作为一个整体,进行纵向的计算。
1. count:计算个数
1. 一般选择非空的列:主键
2. count(*)
2. max:计算最大值
3. min:计算最小值
4. sum:计算和
5. avg:计算平均值
* 注意:聚合函数的计算,排除null值。
解决方案:
...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/07/23/1/" title="MySQL-基础"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="MySQL-基础"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/23/1/" title="MySQL-基础">MySQL-基础</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-23 11:22:21"><i class="far fa-calendar-alt"></i>2020-07-23</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/MySQL/">MySQL</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/MySQL/">MySQL</a></span></div><div class="content">数据库
数据库的基本概念
MySQL数据库软件
安装
卸载
配置
SQL
数据库的基本概念1. 数据库的英文单词: DataBase 简称 : DB
2. 什么数据库?
* 用于存储和管理数据的仓库。
3. 数据库的特点:
1. 持久化存储数据的。其实数据库就是一个文件系统
2. 方便存储和管理数据
3. 使用了统一的方式操作数据库 -- SQL​​ 4. 常见的数据库软件​ * 参见《MySQL基础.pdf》
MySQL数据库软件1. 安装
* 参见《MySQL基础.pdf》
2. 卸载
1. 去mysql的安装目录找到my.ini文件
* 复制 datadir=&quot;C:/ProgramData/MySQL/MySQL Server 5.5/Data/&quot;
2. 卸载MySQL
3. 删除C:/ProgramData目录下的MySQL文件夹。
3. 配置
* MySQL服务启动
1. 手动。
2. cmd--&g ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/07/22/1/" title="Java-反射、注解"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-反射、注解"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/22/1/" title="Java-反射、注解">Java-反射、注解</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-22 20:08:41"><i class="far fa-calendar-alt"></i>2020-07-22</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/%E6%B3%A8%E8%A7%A3/">注解</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/%E5%8F%8D%E5%B0%84/">反射</a></span></div><div class="content">Junit测试:
测试分类
黑盒测试:不需要写代码,给输入值,看程序是否能够输出期望的值
白盒测试:需要写代码.关注程序具体的执行流程
Junit使用: 白盒测试
步骤
定义一个测试类(测试用例)
建议:
测试类名使用被测试类+Test
包名:xxx.xxx.xxx.test
定义测试方法: 可以独立运行
建议:
方法名: test+测试方法名
返回值: void
参数列表: 空参
给方法加注解@Test
点击小灯泡导入Jnuit环境依赖
判定结果
红色: 失败
绿色: 成功
一般使用断言操作处理结果,Assert类中的assertXXX方法 assertEquals(期望的结果,程序运算的结果),若两个数不同显示红色
注解@Before 被修饰的方法会在测试方法之前被自动执行,常用于初始化资源
注解@After 被修饰的方法会在测试方法之后被自动执行,常用于释放资源
反射框架设计的灵魂
反射:将类的各个部分封装成其他对象,这就是反射机制
好处:
可以在程序的运行过程中,操作这些对象
可以解耦,提高程序的可扩展性
获取class类对象的三种方式
...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/07/20/2/" title="Java-Stream流"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-Stream流"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/20/2/" title="Java-Stream流">Java-Stream流</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-20 15:50:13"><i class="far fa-calendar-alt"></i>2020-07-20</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/Stream/">Stream</a></span></div><div class="content">Stream流用于解决已有集合类库既有的弊端,用来对集合和数组进行简化操作
当使用一个流的时候,通常包含三个基本步骤:获取一个数据源(source)-&gt;数据转换-&gt;执行操作获取想要的结果-&gt;每次转换原有Stream对象不改变,返回一个新的Stream对象(可以有多次转换),这就允许对其操作可以像链条一样排列,变成一个管道
12345678910111213141516171819202122/* * Stream是1.8之后出现的,关注的是做什么,而不是怎么做 * 过滤集合,只要张开头,长度为3的 * */public class TestStream &#123; public static void main(String[] args) &#123; ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;(); list.add("张无忌"); list.add("周芷若"); list.add("赵敏"); list.add("张强") ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/07/19/2/" title="Java-函数式接口"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-函数式接口"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/19/2/" title="Java-函数式接口">Java-函数式接口</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-19 21:30:17"><i class="far fa-calendar-alt"></i>2020-07-19</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/Lambda/">Lambda</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/%E5%87%BD%E6%95%B0%E5%BC%8F%E6%8E%A5%E5%8F%A3/">函数式接口</a></span></div><div class="content">函数式接口有且仅有一个抽象方法的接口,叫做函数式接口即适用于函数式编程场景的接口,也就是使用Lambda编程
12345格式: 修饰符 interface 接口名称&#123; public abstract 返回值类型 方法名称(可选参数信息); //其他非抽象方法内容,默认方法,静态方法,私有方法 &#125;
语法糖:指使用更加方便,但是原理不变的代码语法,例如使用for-each语法,其实底层实现的原理仍然使迭代器,这便是”语法糖”,从应用层面来讲,Java的Lambda可以被当作使匿名内部类的”语法糖”,但使二者在原理上是不同的,匿名内部类会创建一个.class文件,而使用Lambda表达式就不会
12345678910/** 注解:检测所写代码是否符合要求,若不符合,则编译报错* @FunctionalInterface:检测接口是否为一个函数式接口* 是:编译成功* 否:编译失败(抽象方法的个数不为一个)* */@FunctionalInterfacepublic interface Function &#123; pu ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/07/19/1/" title="Java-网络编程"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-网络编程"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/19/1/" title="Java-网络编程">Java-网络编程</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-19 12:30:17"><i class="far fa-calendar-alt"></i>2020-07-19</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/Socket/">Socket</a></span></div><div class="content">网络编程UDP
用户数据报协议(User Datagram Protocol),UDP是无连接协议,即在数据传输时,数据的发送端和接收端不建立逻辑连接
耗资小,通信效率高,通常用于音频,视频,和普通数据的传输,因为这种情况偶尔丢失一两个数据包,也不会对接收结果产生太大的影响,但是使用UDP不保证数据的完整性.
特点:数据被限制在64KB以内,超出这个范围就不能发送了
TCP
传输控制协议(Transmission Control Protocol) TCP是面向连接的通信协议,传输数据之前.在发送端和接收端会建立逻辑连接,可靠无差错的数据传输
三次握手
第一次握手 客户端向服务器端发出连接请求,等待服务器确认
第二次握手 服务器端向客户端回送一个响应,通知客户端接收到了连接请求
第三次握手 客户端再次向服务器端发送确认信息,确认连接
服务器端
12345678910111213141516171819202122232425262728293031323334/**TCP通信的服务器端:接收客户端的请求,读取客户端发送的数据,给客户端回写数据* 表示服务器的类:* j ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2020/07/18/1/" title="Java-File、IO流"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-File、IO流"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/18/1/" title="Java-File、IO流">Java-File、IO流</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-18 10:30:50"><i class="far fa-calendar-alt"></i>2020-07-18</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/FIle/">FIle</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/IO/">IO</a></span></div><div class="content">File类java.io.File类是文件和目录路径名的抽象表示,主要用于文件和目录的创建、查找和删除等操作,File是一个与系统无关的类,任何的操作系统都可以使用类中的方法,
记住三个词: file:文件 directory :文件夹/目录 path :路径
静态变量
static String pathSeparator 与系统有关的路径分隔符,为了方便,它被表示为一个字符串。
windows 为”;”
Linux 为”:”
static String separator 与系统有关的默认名称分隔符,为了方便,它被表示为一个字符串。 文件名称分隔符
windows 为”\“
Linux 为”/“
构造方法
File(File parent, String child) 根据 parent 抽象路径名和 child 路径名字符串创建一个新 File 实例。
File(String pathname) 通过将给定路径名字符串转换为抽象路径名来创建一个新 File 实例。
File(String parent, Str ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2020/07/15/3/" title="Java-Lambda表达式"> <img class="post_bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java-Lambda表达式"></a></div><div class="recent-post-info"><a class="article-title" href="/2020/07/15/3/" title="Java-Lambda表达式">Java-Lambda表达式</a><div class="article-meta-wrap"><time class="post-meta__date" title="发表于 2020-07-15 19:53:08"><i class="far fa-calendar-alt"></i>2020-07-15</time><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Java/">Java</a></span><span class="article-meta tags"><span class="article-meta__separator">|</span><i class="fas fa-tag article-meta__icon"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta__link"></span><a class="article-meta__tags" href="/tags/Lambda/">Lambda</a></span></div><div class="content">lambda表达式
jdk8发布
12345678910111213141516171819202122232425262728293031/*lambda的标准格式 由三部分组成 一些参数 一个箭头 一段代码 (参数列表) -&gt; &#123;一些重写方法的代码&#125;;*/public static void main(String[] args) &#123; //普通多线程方式 new Thread(new Runnable() &#123; @Override public void run() &#123; System.out.println("线程创建"); &#125; &#125;).start(); //使用Lambda表达式实现多线程 //大括号就是重写run方法的大括号 new Thread(() -&gt; &#123; System.out.println("lambda实现多线程"); ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><a class="extend next" rel="next" href="/page/2/"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" src="https://gitee.com/lqhao/img-bed/raw/master/img-page/04232036663275.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">laden</div><div class="author-info__description">万丈高楼平地起,一切承担靠地基</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives"><div class="headline">文章</div><div class="length_num">16</div></a></div><div class="card-info-data-item is-center"> <a href="/tags"><div class="headline">标签</div><div class="length_num">20</div></a></div><div class="card-info-data-item is-center"> <a href="/categories"><div class="headline">分类</div><div class="length_num">4</div></a></div></div><div class="card-info-bookmark is-center"><button class="button--animated" id="bookmark-it" title="加入书签"><i class="fas fa-bookmark"></i><span>加入书签</span></button></div><div class="card-info-social-icons is-center"><a class="social-icon" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=949132421@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-recent-item"><div class="aside-recent-post"><a href="/2020/07/25/2/"><div class="aside-post-cover"><img class="aside-post-bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" title="Java-JDBC连接池、JDBCTemplate" alt="Java-JDBC连接池、JDBCTemplate"/></div><div class="aside-post-title"><div class="aside-post_title" href="/2020/07/25/2/" title="Java-JDBC连接池、JDBCTemplate">Java-JDBC连接池、JDBCTemplate</div><time class="aside-post_meta post-meta__date" title="发表于 2020-07-25 19:41:52">2020-07-25</time></div></a></div><div class="aside-recent-post"><a href="/2020/07/25/ckd1l6zch0000y4ndh8csb75o/"><div class="aside-post-cover"><img class="aside-post-bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" title="Java-JDBC" alt="Java-JDBC"/></div><div class="aside-post-title"><div class="aside-post_title" href="/2020/07/25/ckd1l6zch0000y4ndh8csb75o/" title="Java-JDBC">Java-JDBC</div><time class="aside-post_meta post-meta__date" title="发表于 2020-07-25 19:40:18">2020-07-25</time></div></a></div><div class="aside-recent-post"><a href="/2020/07/23/2/"><div class="aside-post-cover"><img class="aside-post-bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" title="MySQL-约束" alt="MySQL-约束"/></div><div class="aside-post-title"><div class="aside-post_title" href="/2020/07/23/2/" title="MySQL-约束">MySQL-约束</div><time class="aside-post_meta post-meta__date" title="发表于 2020-07-23 16:54:40">2020-07-23</time></div></a></div><div class="aside-recent-post"><a href="/2020/07/23/1/"><div class="aside-post-cover"><img class="aside-post-bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" title="MySQL-基础" alt="MySQL-基础"/></div><div class="aside-post-title"><div class="aside-post_title" href="/2020/07/23/1/" title="MySQL-基础">MySQL-基础</div><time class="aside-post_meta post-meta__date" title="发表于 2020-07-23 11:22:21">2020-07-23</time></div></a></div><div class="aside-recent-post"><a href="/2020/07/22/1/"><div class="aside-post-cover"><img class="aside-post-bg" data-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" title="Java-反射、注解" alt="Java-反射、注解"/></div><div class="aside-post-title"><div class="aside-post_title" href="/2020/07/22/1/" title="Java-反射、注解">Java-反射、注解</div><time class="aside-post_meta post-meta__date" title="发表于 2020-07-22 20:08:41">2020-07-22</time></div></a></div></div></div></div><div class="card-widget card-categories"><div class="card-content"><div class="item-headline"><i class="fas fa-folder-open"></i><span>分类</span></div><ul class="card-category-list">
<li class="card-category-list-item "><a class="card-category-list-link" href="/categories/API%E6%96%87%E6%A1%A3/"><span class="card-category-list-name">API文档</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Java/"><span class="card-category-list-name">Java</span><span class="card-category-list-count">11</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/MySQL/"><span class="card-category-list-name">MySQL</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/hexo/"><span class="card-category-list-name">hexo</span><span class="card-category-list-count">1</span></a></li>
</ul></div></div><div class="card-widget card-tags"><div class="card-content"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href='/tags/API/' style='font-size:18px; color:rgb(7, 166, 120)'>API</a><a href='/tags/ArrayList/' style='font-size:20px; color:rgb(129, 70, 16)'>ArrayList</a><a href='/tags/Collection/' style='font-size:20px; color:rgb(46, 158, 181)'>Collection</a><a href='/tags/Exception/' style='font-size:20px; color:rgb(140, 183, 57)'>Exception</a><a href='/tags/FIle/' style='font-size:16px; color:rgb(72, 163, 0)'>FIle</a><a href='/tags/IO/' style='font-size:21px; color:rgb(42, 4, 69)'>IO</a><a href='/tags/Java/' style='font-size:16px; color:rgb(178, 82, 33)'>Java</a><a href='/tags/Lambda/' style='font-size:21px; color:rgb(99, 89, 94)'>Lambda</a><a href='/tags/MySQL/' style='font-size:21px; color:rgb(133, 28, 129)'>MySQL</a><a href='/tags/Socket/' style='font-size:20px; color:rgb(12, 104, 168)'>Socket</a><a href='/tags/Stream/' style='font-size:19px; color:rgb(141, 142, 77)'>Stream</a><a href='/tags/String/' style='font-size:19px; color:rgb(17, 141, 80)'>String</a><a href='/tags/Template/' style='font-size:17px; color:rgb(196, 184, 0)'>Template</a><a href='/tags/Thread/' style='font-size:21px; color:rgb(141, 138, 105)'>Thread</a><a href='/tags/hexo/' style='font-size:18px; color:rgb(184, 182, 178)'>hexo</a><a href='/tags/linux/' style='font-size:17px; color:rgb(169, 175, 160)'>linux</a><a href='/tags/%E5%87%BD%E6%95%B0%E5%BC%8F%E6%8E%A5%E5%8F%A3/' style='font-size:20px; color:rgb(153, 180, 113)'>函数式接口</a><a href='/tags/%E5%8F%8D%E5%B0%84/' style='font-size:18px; color:rgb(195, 20, 166)'>反射</a><a href='/tags/%E6%B3%A8%E8%A7%A3/' style='font-size:21px; color:rgb(198, 179, 104)'>注解</a><a href='/tags/%E8%BF%9E%E6%8E%A5%E6%B1%A0/' style='font-size:17px; color:rgb(96, 134, 119)'>连接池</a></div></div></div><div class="card-widget card-archives"><div class="card-content"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/07/"><span class="card-archive-list-date">七月 2020</span><span class="card-archive-list-count">16</span></a></li></ul></div></div><div class="card-widget card-webinfo"><div class="card-content"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="webinfo-article-name">文章数目 :</div><div class="webinfo-article-count">16</div></div><div class="webinfo-item"><div class="webinfo-runtime-name">已运行时间 :</div><div class="webinfo-runtime-count" id="webinfo-runtime-count" publish_date="7/6/2020 00:00:00"> </div></div><div class="webinfo-item"><div class="webinfo-site-wordcount-name">本站总字数 :</div><div class="webinfo-site-wordcount">55.7k</div></div><div class="webinfo-item"> <div class="webinfo-site-uv-name">本站访客数 :</div><div class="webinfo-site-uv-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="webinfo-site-name">本站总访问量 :</div><div class="webinfo-site-pv-count" id="busuanzi_value_site_pv"></div></div></div></div></div></div></main><footer id="footer" style="background-image: url(https://gitee.com/lqhao/img-bed/raw/master/img-page/index3.jpg)" data-type="photo"><div id="footer-wrap"><div class="copyright">&copy;2020 By laden</div><div class="framework-info"><span>驱动 </span><a href="https://hexo.io" target="_blank" rel="noopener"><span>Hexo</span></a><span class="footer-separator">|</span><span>主题 </span><a href="https://github.com/jerryc127/hexo-theme-butterfly" target="_blank" rel="noopener"><span>Butterfly</span></a></div><div class="footer_custom_text">Hi, welcome to my <a href="https://jerryc.me/" target="_blank" rel="noopener">blog</a>!</div></div></footer></div><section class="rightside" id="rightside"><div id="rightside-config-hide"><button id="darkmode" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" title="设置"><i class="fas fa-cog"></i></button><button id="go-up" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></section><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script id="ribbon_piao" mobile="true" src="/js/third-party/piao.js"></script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js" async></script><script src="https://cdn.jsdelivr.net/npm/typed.js"></script><script>var subtitleEffect = true
if (subtitleEffect) {
var typed = new Typed("#subtitle", {
strings: "Never give up,要想生活的有意义&#44; 就要时刻有激情".split(","),
startDelay: 300,
typeSpeed: 150,
loop: true,
backSpeed: 50
})
} else {
document.getElementById("subtitle").innerHTML = 'Never give up'
}</script></body></html>

Comment ( 0 )

Sign in for post a comment

NodeJS
1
https://gitee.com/lqhao/lqhao.git
git@gitee.com:lqhao/lqhao.git
lqhao
lqhao
lqhao
master

Search