《Java IO、NIO and NIO2(中文版)》第7章 通道

      通道与缓冲区合作以实现高性能I / O。 本章向您介绍NIO的通道类型。

介绍通道

      通道是一个对象,表示与硬件设备,文件,网络套接字,应用程序组件或其他能够执行写入,读取和其他I / O操作的实体的开放连接。 通道有效地在字节缓冲区和基于操作系统的I / O服务源或目标之间传输数据。

注  

   通道是访问I / O服务的网关。 通道使用字节缓冲区作为发送和接收数据的端点。

     操作系统文件句柄或文件描述符与通道之间经常存在一对一的对应关系。 当您在文件上下文中使用通道时,通道通常会连接到打开的文件描述符。 尽管通道比文件描述符更抽象,但它们仍然能够对操作系统的I / O设施进行建模。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Input/output (I/O) is not a sexy subject, but it’s an important part of non-trivial applications. This book introduces you to most of Java’s I/O capabilities as of Java 8 update 51. Chapter 1 presents a broad overview of I/O in terms of Java’s classic I/O, New I/O (NIO), and NIO.2 categories. You learn what each category offers in terms of its capabilities, and you also learn about concepts such as paths and Direct Memory Access. Chapters 2 through 5 cover classic I/O APIs. You learn about the File and RandomAccessFile classes along with streams (including object serialization and externalization) and writers/readers. Chapters 6 through 11 focus on NIO. You explore buffers, channels, selectors, regular expressions, charsets, and formatters. (Formatters were not introduced with the other NIO types in Java 1.4 because they depend on the variable arguments capability that was introduced in Java 5.) NIO is missing several features, which were subsequently provided by NIO.2. Chapters 12 through 14 cover NIO.2’s improved file system interface, asynchronous I/O, and the completion of socket channel functionality. Each chapter ends with assorted exercises that are designed to help you master its content. Along with long answers and true/false questions, you are often confronted with programming exercises. Appendix A provides the answers and solutions. Appendix B provides a tutorial on sockets and network interfaces. Although not directly related to classic I/O, NIO, and NIO.2, they leverage I/O capabilities and are mentioned elsewhere in this book.
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值