没有合适的资源?快使用搜索试试~ 我知道了~
首页High Performance Java IO And Regular Expressions 高性能JAVA IO 与正则表达式
High Performance Java IO And Regular Expressions 高性能JAVA IO 与正则表...
5星 · 超过95%的资源 需积分: 9 38 下载量 182 浏览量
更新于2023-03-03
评论
收藏 1.36MB PDF 举报
High Performance Java IO And Regular Expressions 高性能JAVA IO 与正则表达式
资源详情
资源评论
资源推荐
Java New I/O
High Performance Java I/O And Regular Expressions
*** AUTHOR'S DRAFT, Do Not Copy ***
by Ron Hitchens
Java New I/O: High Performance Java I/O And Regular Expressions:
*** AUTHOR'S DRAFT, Do Not Copy ***
by Ron Hitchens
Copyright © 2002 Ron Hitchens
This book is an examination of the New I/O (NIO) packages added to the Java Platform in the 1.4 release.
Table of Contents
Preface....................................................................................................................................................................
Organization ........................................................................................................................................ 13
Who Should Read This Book .............................................................................................................. 14
Software and Versions ........................................................................................................................ 15
Conventions Used In This Book ......................................................................................................... 15
Font Conventions ............................................................................................................. 16
Comments and Questions .................................................................................................................... 17
Acknowledgements ............................................................................................................................. 18
1Introduction.........................................................................................................................................................
I/O vs CPU Time ................................................................................................................................. 1
No Longer CPU Bound ....................................................................................................................... 2
Getting To The Good Stuff ................................................................................................................. 3
I/O Concepts ........................................................................................................................................ 3
Buffer Handling ............................................................................................................... 4
Scatter/Gather ............................................................................................... 5
Virtual Memory ................................................................................................................ 6
Memory Paging ................................................................................................................ 7
File I/O ............................................................................................................................. 9
Memory Mapped Files .................................................................................. 10
File Locking .................................................................................................. 11
Stream I/O ........................................................................................................................ 12
Summary ............................................................................................................................................. 13
2Buffers.................................................................................................................................................................
Buffer Basics ....................................................................................................................................... 15
Attributes .......................................................................................................................... 15
Buffer API ........................................................................................................................ 16
Accessing ......................................................................................................................... 17
Filling ............................................................................................................................... 18
Flipping ............................................................................................................................ 19
Draining ........................................................................................................................... 20
Compacting ...................................................................................................................... 22
Marking ............................................................................................................................ 23
Comparing ........................................................................................................................ 24
Bulk Moves ...................................................................................................................... 28
Creating Buffers .................................................................................................................................. 30
Duplicating Buffers ............................................................................................................................. 32
Byte Buffers ........................................................................................................................................ 34
Byte Ordering ................................................................................................................... 36
Direct Buffers ................................................................................................................... 39
View Buffers .................................................................................................................... 40
Data Element Views ......................................................................................................... 42
Accessing Unsigned Data ................................................................................................ 45
Memory Mapped Buffers ................................................................................................. 46
Summary ............................................................................................................................................. 46
3Channels..............................................................................................................................................................
Channel Basics .................................................................................................................................... 51
Opening Channels ............................................................................................................ 51
Using Channels ................................................................................................................ 52
Closing Channels ............................................................................................................. 56
Scatter/Gather ...................................................................................................................................... 58
File Channels ....................................................................................................................................... 63
Accessing Files ................................................................................................................ 66
File Locking ..................................................................................................................... 70
Example Code Using File Locking ............................................................... 72
Memory Mapped Files ..................................................................................................... 75
Example Code Using MappedByteBuffer and Gathering Writes ......... 79
Channel-To-Channel Transfers ........................................................................................ 83
Socket Channels .................................................................................................................................. 85
Non-Blocking Mode ......................................................................................................... 87
ServerSocketChannel ............................................................................................ 88
SocketChannel ........................................................................................................... 90
DatagramChannel ...................................................................................................... 93
Example DatagramChannel Code .......................................................... 97
Pipes .................................................................................................................................................... 102
The Channels Utility Class ............................................................................................................. 107
Summary ............................................................................................................................................. 108
4Selectors..............................................................................................................................................................
Selector Basics .................................................................................................................................... 112
The Selector, SelectableChannel and SelectionKey Classes ................... 113
Setting Up Selectors ......................................................................................................... 116
Using Selection Keys .......................................................................................................................... 118
Using Selectors .................................................................................................................................... 121
The Selection Process ...................................................................................................... 121
Stopping the Selection Process ........................................................................................ 123
Managing Selection Keys ................................................................................................ 124
Concurrency ..................................................................................................................... 128
Asynchronous Closability ................................................................................................................... 129
Selection Scaling ................................................................................................................................. 129
Summary ............................................................................................................................................. 134
5RegularExpressions............................................................................................................................................
Regular Expression Basics .................................................................................................................. 137
The Java Regular Expression API ....................................................................................................... 138
The CharSequence Interface ...................................................................................... 138
The Pattern Class ........................................................................................................ 140
Splitting Strings With The Pattern Class ................................................. 145
The Matcher Class ........................................................................................................ 148
Regular Expression Methods of the String Class ........................................................................... 159
Java Regular Expression Syntax ......................................................................................................... 160
An Object-Oriented File Grep ............................................................................................................. 163
Summary ............................................................................................................................................. 168
6CharacterSets......................................................................................................................................................
Character Set Basics ............................................................................................................................ 169
Charsets ............................................................................................................................................... 171
The Charset Class ........................................................................................................ 174
Comparing Charsets ......................................................................................................... 176
Charset Encoders .............................................................................................................. 177
The CoderResult Class .................................................................................. 182
Character Encoding Example ....................................................................... 183
Charset Decoders ............................................................................................................. 186
Character Decoding Example ....................................................................... 189
The Charset Service Provider Interface .......................................................................................... 191
Creating Custom Charsets ................................................................................................ 192
Providing Your Custom Charsets .................................................................................... 194
Custom Charset Example ................................................................................................. 196
剩余254页未读,继续阅读
cooltaoism
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 27页智慧街道信息化建设综合解决方案.pptx
- 计算机二级Ms-Office选择题汇总.doc
- 单链表的插入和删除实验报告 (2).docx
- 单链表的插入和删除实验报告.pdf
- 物联网智能终端项目设备管理方案.pdf
- 如何打造品牌的模式.doc
- 样式控制与页面布局.pdf
- 武汉理工Java实验报告(二).docx
- 2021线上新品消费趋势报告.pdf
- 第3章 Matlab中的矩阵及其运算.docx
- 基于Web的人力资源管理系统的必要性和可行性.doc
- 基于一阶倒立摆的matlab仿真实验.doc
- 速运公司物流管理模式研究教材
- 大数据与管理.pptx
- 单片机课程设计之步进电机.doc
- 大数据与数据挖掘.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2