没有合适的资源?快使用搜索试试~ 我知道了~
High Performance Java IO And Regular Expressions 高性能JAVA IO 与正则表...
5星 · 超过95%的资源 需积分: 9 38 下载量 56 浏览量
2009-03-05
20:19:10
上传
评论
收藏 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页未读,继续阅读
资源评论
- 技术开发到天荒地老2013-06-25确实是好东西,学到了新的知识.
- oneinmore2019-03-14这是个草稿,是java nio那本书的草稿;本身是文字版
cooltaoism
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功