更新附录部分章节子标题

This commit is contained in:
LingCoder
2019-03-25 04:56:56 +08:00
parent e3680ca08b
commit b8869607e0
16 changed files with 343 additions and 73 deletions

View File

@@ -335,84 +335,84 @@
* [通过Thinking-in-C来巩固Java基础](book/Appendix-Supplements.md#通过Thinking-in-C来巩固Java基础)
* [动手实践](book/Appendix-Supplements.md#动手实践)
* [附录:编程指南](book/Appendix-Programming-Guidelines.md)
* [](book/Appendix-Programming-Guidelines.md#)
* [](book/Appendix-Programming-Guidelines.md#)
* [设计](book/Appendix-Programming-Guidelines.md#设计)
* [实现](book/Appendix-Programming-Guidelines.md#实现)
* [附录:文档注释](book/Appendix-Javadoc.md)
* [附录:对象传递和返回](book/Appendix-Passing-and-Returning-Objects.md)
* [](book/Appendix-Passing-and-Returning-Objects.md#)
* [](book/Appendix-Passing-and-Returning-Objects.md#)
* [](book/Appendix-Passing-and-Returning-Objects.md#)
* [](book/Appendix-Passing-and-Returning-Objects.md#)
* [传递引用](book/Appendix-Passing-and-Returning-Objects.md#传递引用)
* [本地拷贝](book/Appendix-Passing-and-Returning-Objects.md#本地拷贝)
* [控制克隆](book/Appendix-Passing-and-Returning-Objects.md#控制克隆)
* [不可变类](book/Appendix-Passing-and-Returning-Objects.md#不可变类)
* [本章小结](book/Appendix-Passing-and-Returning-Objects.md#本章小结)
* [附录:流式IO](book/Appendix-IO-Streams.md)
* [](book/Appendix-IO-Streams.md#)
* [](book/Appendix-IO-Streams.md#)
* [](book/Appendix-IO-Streams.md#)
* [](book/Appendix-IO-Streams.md#)
* [](book/Appendix-IO-Streams.md#)
* [](book/Appendix-IO-Streams.md#)
* [输入流类型](book/Appendix-IO-Streams.md#输入流类型)
* [输出流类型](book/Appendix-IO-Streams.md#输出流类型)
* [添加属性和有用的接口](book/Appendix-IO-Streams.md#添加属性和有用的接口)
* [Reader和Writer](book/Appendix-IO-Streams.md#Reader和Writer)
* [RandomAccessFile类](book/Appendix-IO-Streams.md#RandomAccessFile类)
* [IO流典型用途](book/Appendix-IO-Streams.md#IO流典型用途)
* [本章小结](book/Appendix-IO-Streams.md#本章小结)
* [附录:标准IO](book/Appendix-Standard-IO.md)
* [](book/Appendix-Standard-IO.md#)
* [执行控制](book/Appendix-Standard-IO.md#执行控制)
* [附录:新IO](book/Appendix-New-IO.md)
* [](book/Appendix-New-IO.md#)
* [](book/Appendix-New-IO.md#)
* [](book/Appendix-New-IO.md#)
* [](book/Appendix-New-IO.md#)
* [](book/Appendix-New-IO.md#)
* [](book/Appendix-New-IO.md#)
* [](book/Appendix-New-IO.md#)
* [ByteBuffer](book/Appendix-New-IO.md#ByteBuffer)
* [转换数据](book/Appendix-New-IO.md#转换数据)
* [获取原始类型](book/Appendix-New-IO.md#获取原始类型)
* [视图缓冲区](book/Appendix-New-IO.md#视图缓冲区)
* [使用缓冲区进行数据操作](book/Appendix-New-IO.md#使用缓冲区进行数据操作)
* [内存映射文件](book/Appendix-New-IO.md#内存映射文件)
* [文件锁定](book/Appendix-New-IO.md#文件锁定)
* [附录:理解equals和hashCode方法](book/Appendix-Understanding-equals-and-hashCode.md)
* [](book/Appendix-Understanding-equals-and-hashCode.md#)
* [](book/Appendix-Understanding-equals-and-hashCode.md#)
* [](book/Appendix-Understanding-equals-and-hashCode.md#)
* [equals典范](book/Appendix-Understanding-equals-and-hashCode.md#equals典范)
* [哈希和哈希码](book/Appendix-Understanding-equals-and-hashCode.md#哈希和哈希码)
* [调整HashMap](book/Appendix-Understanding-equals-and-hashCode.md#调整HashMap)
* [附录:集合主题](book/Appendix-Collection-Topics.md)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [](book/Appendix-Collection-Topics.md#)
* [示例数据](book/Appendix-Collection-Topics.md#示例数据)
* [List表现](book/Appendix-Collection-Topics.md#List表现)
* [Set表现](book/Appendix-Collection-Topics.md#Set表现)
* [在Map中使用函数式操作](book/Appendix-Collection-Topics.md#在Map中使用函数式操作)
* [选择Map的部分](book/Appendix-Collection-Topics.md#选择Map的部分)
* [集合的fill方法](book/Appendix-Collection-Topics.md#集合的fill方法)
* [使用Flyweight自定义集合和Map](book/Appendix-Collection-Topics.md#使用Flyweight自定义集合和Map)
* [集合功能](book/Appendix-Collection-Topics.md#集合功能)
* [可选操作](book/Appendix-Collection-Topics.md#可选操作)
* [Set和存储顺序](book/Appendix-Collection-Topics.md#Set和存储顺序)
* [队列](book/Appendix-Collection-Topics.md#队列)
* [理解Map](book/Appendix-Collection-Topics.md#理解Map)
* [集合工具类](book/Appendix-Collection-Topics.md#集合工具类)
* [持有引用](book/Appendix-Collection-Topics.md#持有引用)
* [避免旧式类库](book/Appendix-Collection-Topics.md#避免旧式类库)
* [本章小结](book/Appendix-Collection-Topics.md#本章小结)
* [附录:并发底层原理](book/Appendix-Low-Level-Concurrency.md)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [](book/Appendix-Low-Level-Concurrency.md#)
* [线程](book/Appendix-Low-Level-Concurrency.md#线程)
* [异常捕获](book/Appendix-Low-Level-Concurrency.md#异常捕获)
* [资源共享](book/Appendix-Low-Level-Concurrency.md#资源共享)
* [volatile关键字](book/Appendix-Low-Level-Concurrency.md#volatile关键字)
* [原子性](book/Appendix-Low-Level-Concurrency.md#原子性)
* [关键部分](book/Appendix-Low-Level-Concurrency.md#关键部分)
* [库组件](book/Appendix-Low-Level-Concurrency.md#库组件)
* [本章小结](book/Appendix-Low-Level-Concurrency.md#本章小结)
* [附录:数据压缩](book/Appendix-Data-Compression.md)
* [](book/Appendix-Data-Compression.md#)
* [](book/Appendix-Data-Compression.md#)
* [](book/Appendix-Data-Compression.md#)
* [使用Gzip简单压缩](book/Appendix-Data-Compression.md#使用Gzip简单压缩)
* [使用zip多文件存储](book/Appendix-Data-Compression.md#使用zip多文件存储)
* [Java的jar](book/Appendix-Data-Compression.md#Java的jar)
* [附录:对象序列化](book/Appendix-Object-Serialization.md)
* [](book/Appendix-Object-Serialization.md#)
* [](book/Appendix-Object-Serialization.md#)
* [](book/Appendix-Object-Serialization.md#)
* [查找类](book/Appendix-Object-Serialization.md#查找类)
* [控制序列化](book/Appendix-Object-Serialization.md#控制序列化)
* [使用持久化](book/Appendix-Object-Serialization.md#使用持久化)
* [附录:静态语言类型检查](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md)
* [](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#)
* [](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#)
* [](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#)
* [](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#)
* [](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#)
* [前言](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#前言)
* [静态类型检查和测试](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#静态类型检查和测试)
* [如何提升打字](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#如何提升打字)
* [生产力的成本](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#生产力的成本)
* [静态和动态](book/Appendix-Benefits-and-Costs-of-Static-Type-Checking.md#静态和动态)
* [附录:C++和Java的优良传统](book/Appendix-The-Positive-Legacy-of-C-plus-plus-and-Java.md)
* [附录:成为一名程序员](book/Appendix-Becoming-a-Programmer.md)
* [](book/Appendix-Becoming-a-Programmer.md#)
* [](book/Appendix-Becoming-a-Programmer.md#)
* [](book/Appendix-Becoming-a-Programmer.md#)
* [](book/Appendix-Becoming-a-Programmer.md#)
* [](book/Appendix-Becoming-a-Programmer.md#)
* [](book/Appendix-Becoming-a-Programmer.md#)
* [如何开始](book/Appendix-Becoming-a-Programmer.md#如何开始)
* [码农生涯](book/Appendix-Becoming-a-Programmer.md#码农生涯)
* [百分之五的神话](book/Appendix-Becoming-a-Programmer.md#百分之五的神话)
* [重在动手](book/Appendix-Becoming-a-Programmer.md#重在动手)
* [像打字般编程](book/Appendix-Becoming-a-Programmer.md#像打字般编程)
* [做你喜欢的事](book/Appendix-Becoming-a-Programmer.md#做你喜欢的事)
* [词汇表](GLOSSARY.md)

View File

@@ -1,7 +1,32 @@
[TOC]
<!-- Appendix: Becoming a Programmer -->
# 附录:成为一名程序员
<!-- How I Got Started in Programming -->
## 如何开始
<!-- A Career in Computing -->
## 码农生涯
<!-- The Mythical 5% -->
## 百分之五的神话
<!-- Writing Software Is Like … Writing -->
## 重在动手
<!-- Programming as Typing -->
## 像打字般编程
<!-- Do What You Love -->
## 做你喜欢的事
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,29 @@
[TOC]
<!-- Appendix: Benefits and Costs of Static Type Checking -->
# 附录:静态语言类型检查
<!-- Foreword -->
## 前言
<!-- Static Type Checking vs. Testing -->
## 静态类型检查和测试
<!-- How to Argue about Typing -->
## 如何提升打字
<!-- The Cost of Productivity -->
## 生产力的成本
<!-- Static vs. Dynamic -->
## 静态和动态
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,78 @@
[TOC]
<!-- Appendix: Collection Topics -->
# 附录:集合主题
<!-- Sample Data -->
## 示例数据
<!-- List Behavior -->
## List表现
<!-- Set Behavior -->
## Set表现
<!-- Using Functional Operations with any Map -->
## 在Map中使用函数式操作
<!-- Selecting Parts of a Map -->
## 选择Map的部分
<!-- Filling Collections -->
## 集合的fill方法
<!-- Custom Collection and Map using Flyweight -->
## 使用Flyweight自定义集合和Map
<!-- Collection Functionality -->
## 集合功能
<!-- Optional Operations -->
## 可选操作
<!-- Sets and Storage Order -->
## Set和存储顺序
<!-- Queues -->
## 队列
<!-- Understanding Maps -->
## 理解Map
<!-- Utilities -->
## 集合工具类
<!-- Holding References -->
## 持有引用
<!-- Java 1.0/1.1 Collections -->
## 避免旧式类库
<!-- Summary -->
## 本章小结
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,20 @@
[TOC]
<!-- Appendix: Data Compression -->
# 附录:数据压缩
<!-- Simple Compression with GZIP -->
## 使用Gzip简单压缩
<!-- Multifile Storage with Zip -->
## 使用zip多文件存储
<!-- Java Archives (Jars) -->
## Java的jar
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,37 @@
[TOC]
<!-- Appendix: I/O Streams -->
# 附录:流式IO
<!-- Types of InputStream -->
## 输入流类型
<!-- Types of OutputStream -->
## 输出流类型
<!-- Adding Attributes and Useful Interfaces -->
## 添加属性和有用的接口
<!-- Readers & Writers -->
## Reader和Writer
<!-- Off By Itself: RandomAccessFile -->
## RandomAccessFile类
<!-- Typical Uses of I/O Streams -->
## IO流典型用途
<!-- Summary -->
## 本章小结
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,5 +1,6 @@
[TOC]
<!-- Appendix: Javadoc -->
# 附录:文档注释
<!-- 分页 -->

View File

@@ -1,4 +1,42 @@
[TOC]
<!-- Appendix: Low-Level Concurrency -->
# 附录:并发底层原理
<!-- What is a Thread? -->
## 线程
<!-- Catching Exceptions -->
## 异常捕获
<!-- Sharing Resources -->
## 资源共享
<!-- The volatile Keyword -->
## volatile关键字
<!-- Atomicity -->
## 原子性
<!-- Critical Sections -->
## 关键部分
<!-- Library Components -->
## 库组件
<!-- Summary -->
## 本章小结
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,5 +1,6 @@
[TOC]
<!-- Appendix: New I/O -->
# 附录:新IO
@@ -11,7 +12,9 @@ Java “新” I/O 库是在Java 1.4引入到 **Java .nio.* package** 中。
本附录将深入探讨 nio 包。像I/O streams 这样的高级库使用 **nio**,但是大多数时候您不需要在这个级别使用 I/O 。在Java 7和Java 8您(理想情况下)除了特殊情况外甚至不需要使用I/O流。理想情况下您将经常使用的所有内容都包含在文件一章中。只有在处理性能问题 (例如,可能需要内存映射文件)或创建自己的 I/O 库时,才需要理解 **nio**
## ByteBuffers
<!-- ByteBufferS -->
## ByteBuffer
直接与通道通信的缓冲区只有一个类型,就是 bytebuffer 。也就是说,一个保存原始字节的缓冲区。如果您查看 **java.nio.ByteBuffer** 的JDK文档你会发现它很基本 : 您可以通过告诉它要分配多少存储空间来创建一个方法,并且可以使用一些方法来放置和获取数据,这些方法可以是原始字节形式的数据,也可以是原始数据类型的数据。但是没有办法放置或获取对象,甚至字符串。它是相当低层次的,因为这使得大多数操作系统的映射更加有效。
@@ -162,10 +165,11 @@ public class TransferTo {
你不会经常这样做,但知道这一点很好。
<!-- Converting Data -->
<!-- Converting Data -->
## 转换数据
**GetChannel** 中打印文件中的信息。在 java 中,我们每次提取一个字节的数据,并将每个字节转换为 char。这看起来很简单——如果您查看**java.nio.CharBuffer** 类您将看到它有一个toString()方法,该方法说,“返回一个包含这个缓冲区中的字符的字符串。”
既然 **ByteBuffer** 可以用 **asCharBuffer()** 方法看作 **CharBuffer**,为什么不使用它呢? 从下面输出语句的第一行可以看出,这并不正确:
@@ -322,10 +326,11 @@ gb2312-1980
由于每个字符需要两个字节这对于12个字符已经足够了但是“some text”只有9个字节。其余的零字节仍然出现在由其toString()生成的CharBuffer的表示中如输出所示。
<!-- Fetching Primitives -->
<!-- Fetching Primitives -->
## 获取原始类型
虽然 **ByteBuffer** 只包含字节,但它包含了一些方法,用于从它所包含的字节中生成每种不同类型的基元值。这个例子展示了使用以下方法插入和提取各种值:
```java
@@ -395,9 +400,9 @@ H o w d y !
这将对每个基本数据类型执行。其中唯一有点奇怪的是 **ShortBuffer****put()**,它需要强制转换 (强制转换并更改结果值)。所有其他视图缓冲区都不需要在它们的 **put()** 方法中强制转换。
<!-- View Buffers -->
## 视图缓冲区
“视图缓冲区”通过特定原始类型的窗口来查看底层 **ByteBuffer**。**ByteBuffer** 仍然是“支持”视图的实际存储,因此对视图所做的任何更改都反映在对 **ByteBuffer** 中的数据的修改中。
如前面的示例所示,这方便地将基本类型插入 **ByteBuffer**。视图缓冲区还可以从 **ByteBuffer** 读取原始值,一次读取一个(ByteBuffer允许),或者批量读取(数组)。下面是一个通过 **IntBuffer**在**ByteBuffer** 中操作 int 的例子:
@@ -569,9 +574,9 @@ public class Endians {
**charArray** 通过 **CharBuffer** 视图插入到 **ByteBuffer **中。当显示底层字节时,默认顺序与随后的大端序相同,而小端序则交换字节。
<!-- Data Manipulation with Buffers -->
## 使用缓冲区进行数据操作
下图说明了 nio 类之间的关系展示了如何移动和转换数据。例如要将字节数组写入文件使用ByteBuffer.wrap() 方法包装字节数组,使用 **getChannel()****FileOutputStream** 上打开通道,然后从 **ByteBuffer** 将数据写入 **FileChannel**
![image-20190324153202297](/Users/langdon/Library/Application Support/typora-user-images/image-20190324153202297.png)
@@ -663,9 +668,9 @@ position 指向缓冲区中的第一个元素capacity 和 limie 紧接在最
再次调用 **symmetricgrab()** 函数时,**CharBuffer** 将经历相同的过程并恢复到原始状态。
<!-- Memory-Mapped Files -->
## 内存映射文件
内存映射文件允许您创建和修改太大而无法放入内存的文件。使用内存映射文件,您可以假装整个文件都在内存中,并将其视为一个非常大的数组来访问它。这种方法大大简化了您编写的修改文件的代码:
```java
@@ -864,8 +869,8 @@ Mapped Read/Write: 0.013
请注意,**test()** 方法包括初始化各种I/O对象的时间因此尽管映射文件的设置可能很昂贵但是与流I/O相比总体收益非常可观。
<!-- File Locking -->
## 文件锁定
### 文件锁定
文件锁定同步访问因此文件可以是共享资源。但是争用同一个文件的两个线程可能位于不同的jvm 中,可能一个是 Java 线程另一个是操作系统中的某个本机线程。文件锁定对其他操作系统进程是可见的因为Java文件锁定直接映射到本机操作系统锁定工具。

View File

@@ -1,7 +1,22 @@
[TOC]
<!-- Appendix: Object Serialization -->
# 附录:对象序列化
<!-- Finding the Class -->
## 查找类
<!-- Controlling Serialization -->
## 控制序列化
<!-- Using Persistence -->
## 使用持久化
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,30 @@
[TOC]
<!-- Appendix: Passing and Returning Objects -->
# 附录:对象传递和返回
<!-- Passing References -->
## 传递引用
<!-- Making Local Copies -->
## 本地拷贝
<!-- Controlling Cloneability -->
## 控制克隆
<!-- Immutable Classes -->
## 不可变类
<!-- Summary -->
## 本章小结
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,18 @@
[TOC]
<!-- Appendix: Programming Guidelines -->
# 附录:编程指南
<!-- Design -->
## 设计
<!-- Implementation -->
## 实现
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,11 @@
[TOC]
<!-- Appendix: Standard I/O -->
# 附录:标准IO
<!-- Process Control -->
## 执行控制
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -15,6 +15,6 @@
<!-- Hands-On Java eSeminar -->
## 动手实践
<!-- 分页 -->
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,8 +1,8 @@
[TOC]
<!-- Appendix: The Positive Legacy of C++ and Java -->
# 附录:C++和Java的优良传统
<!-- 分页 -->
<div style="page-break-after: always;"></div>

View File

@@ -1,7 +1,19 @@
[TOC]
<!-- Appendix: Understanding equals() and hashCode() -->
# 附录:理解equals和hashCode方法
<!-- 分页 -->
<!-- A Canonical equals() -->
## equals典范
<!-- Hashing and Hash Codes -->
## 哈希和哈希码
<!-- Tuning a HashMap -->
## 调整HashMap
<!-- 分页 -->
<div style="page-break-after: always;"></div>