Java I/O, NIO and NIO. 2
معرفی کتاب «Java I/O, NIO and NIO. 2» نوشتهٔ Jeff Friesen (auth.)، منتشرشده توسط نشر Apress : Imprint: Apress در سال 2015. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
Java I/O, NIO, and NIO.2 is a power-packed book that accelerates your mastery of Java's various I/O APIs. In this book, you'll learn about classic I/O APIs (File, RandomAccessFile, the stream classes and related types, and the reader/writer classes). Next, you'll learn about NIO's buffer, channel, selector, regular expression, charset, and formatter APIs. Finally, you'll discover NIO.2's offerings in terms of an improved file system interface, asynchronous I/O, and the completion of socket channel functionality. After reading and using thi book, you'll gain the accelerated knowledge and skill level to really build applications with efficient data access, especially for today's cloud computing streaming data needs. Contents at a Glance 5 Contents 7 About the Author 14 About the Technical Reviewers 15 Acknowledgments 17 Introduction 18 Part I: Getting Started with I/O 20 Chapter 1: I/O Basics and APIs 21 Classic I/O 21 File System Access and the File Class 21 Accessing File Content via RandomAccessFile 23 Streaming Data via Stream Classes 23 Stream Classes and Standard I/O 26 JDK 1.1 and the Writer/Reader Classes 26 NIO 26 Buffers 27 Channels 28 Selectors 29 Regular Expressions 30 Charsets 31 Formatter 31 NIO.2 31 Improved File System Interface 32 Asynchronous I/ O 32 Completion of Socket Channel Functionality 32 Summary 33 Part II: Classic I/O APIs 34 Chapter 2: File 35 Constructing File Instances 35 Learning About Stored Abstract Paths 38 Learning About a Path’s File or Directory 41 Listing File System Root Directories 43 Obtaining Disk Space Information 45 Listing Directories 46 Creating/Modifying Files and Directories 49 Setting and Getting Permissions 53 Exploring Miscellaneous Capabilities 55 Summary 58 Chapter 3: RandomAccessFile 59 Exploring RandomAccessFile 59 Using RandomAccessFile 65 Summary 73 Chapter 4: Streams 74 Stream Classes Overview 74 Touring the Stream Classes 76 OutputStream and InputStream 76 ByteArrayOutputStream and ByteArrayInputStream 79 FileOutputStream and FileInputStream 82 PipedOutputStream and PipedInputStream 86 FilterOutputStream and FilterInputStream 90 BufferedOutputStream and BufferedInputStream 99 DataOutputStream and DataInputStream 101 Object Serialization and Deserialization 103 Default Serialization and Deserialization 104 Custom Serialization and Deserialization 110 Externalization 116 PrintStream 119 Revisiting Standard I/O 122 Summary 126 Chapter 5: Writers and Readers 127 Writer and Reader Classes Overview 128 Writer and Reader 130 OutputStreamWriter and InputStreamReader 131 FileWriter and FileReader 133 BufferedWriter and BufferedReader 135 Summary 138 Part III: New I/O APIs 139 Chapter 6: Buffers 140 Introducing Buffers 140 Buffer and its Children 141 Buffers in Depth 146 Buffer Creation 146 Buffer Writing and Reading 149 Flipping Buffers 152 Marking Buffers 154 Buffer Subclass Operations 155 Byte Ordering 156 Direct Byte Buffers 158 Summary 160 Chapter 7: Channels 161 Introducing Channels 161 Channel and Its Children 161 Channels in Depth 167 Scatter/Gather I/O 167 File Channels 170 Locking Files 176 Mapping Files into Memory 184 Transferring Bytes Among Channels 189 Socket Channels 191 Understanding Nonblocking Mode 192 Exploring Server Socket Channels 194 Exploring Socket Channels 196 Exploring Datagram Channels 201 Pipes 207 Summary 213 Chapter 8: Selectors 214 Selector Fundamentals 215 Selector Demonstration 220 Summary 225 Chapter 9: Regular Expressions 226 Pattern, PatternSyntaxException, and Matcher 226 Character Classes 232 Capturing Groups 234 Boundary Matchers and Zero-Length Matches 235 Quantifiers 236 Practical Regular Expressions 239 Summary 241 Chapter 10: Charsets 242 A Brief Review of the Fundamentals 242 Working with Charsets 243 Charsets and the String Class 250 Summary 252 Chapter 11: Formatter 253 Exploring Formatter 253 Exploring Formattable and FormattableFlags 259 Summary 265 Part IV: More New I/O APIs 266 Chapter 12: Improved File System Interface 267 Architecting a Better File Class 267 File Systems and File System Providers 269 Locating Files with Paths 271 Getting a Path and Accessing Its Name Elements 272 Relative and Absolute Paths 275 Normalization, Relativization, and Resolution 277 Additional Capabilities 279 Performing File System Tasks with Files 281 Accessing File Stores 281 Managing Attributes 284 Determining View Support 286 Exploring the Basic View 289 Reading Basic File Attribute Values in Bulk 290 Getting and Setting Single Basic File Attribute Values 292 Exploring the DOS View 295 Reading DOS File Attribute Values in Bulk 296 Getting and Setting Single DOS File Attribute Values 297 Exploring the POSIX View 298 Reading POSIX File Attribute Values in Bulk 299 Getting and Setting Single POSIX File Attribute Values 300 Exploring the File Owner View 302 Exploring the ACL View 305 Exploring the User-Defined View 308 Exploring the File Store View 311 Managing Files and Directories 313 Checking Paths 313 Creating Files 317 Creating and Deleting Temporary Files 319 Reading Files 321 Writing Files 325 Randomly Accessing Files 328 Creating Directories 333 Creating and Deleting Temporary Directories 335 Listing Directory Content 337 Copying Files 342 Moving Files 347 Deleting Files 350 Managing Symbolic and Hard Links 351 Managing Symbolic Links 351 Managing Hard Links 357 Walking the File Tree 359 Exploring the File Tree-Walking API 359 Copying a File Tree 365 Deleting a File Tree 373 Moving a File Tree 375 Working with Additional Capabilities 378 Using Path Matchers and Watch Services 381 Matching Paths 382 Watching Directories 385 Summary 394 Chapter 13: Asynchronous I/O 395 Asynchronous I/O Overview 396 Asynchronous File Channels 398 Asynchronous Socket Channels 403 AsynchronousServerSocketChannel 404 AsynchronousSocketChannel 411 Asynchronous Channel Groups 418 What About AsynchronousFileChannel? 421 Summary 423 Chapter 14: Completion of Socket Channel Functionality 424 Binding and Option Configuration 424 Channel-Based Multicasting 429 Summary 435 Part V: Appendices 436 Appendix A: Answers to Exercises 437 Chapter 1: I/O Basics and APIs 437 Chapter 2: File 438 Chapter 3: RandomAccessFile 441 Chapter 4: Streams 442 Chapter 5: Writers and Readers 450 Chapter 6: Buffers 452 Chapter 7: Channels 455 Chapter 8: Selectors 459 Chapter 9: Regular Expressions 459 Chapter 10: Charsets 461 Chapter 11: Formatter 463 Chapter 12: Improved File System Interface 464 Chapter 13: Asynchronous I/O 477 Chapter 14: Completion of Socket Channel Functionality 481 Appendix B: Sockets and Network Interfaces 486 Sockets 487 Socket Addresses 489 Socket Options 491 Socket and ServerSocket 493 DatagramSocket and MulticastSocket 500 Network Interfaces 508 Using Network Interfaces with Sockets 516 Index 518 Java I/O, NIO and NIO. 2 is a power-packed book that is an accelerated guide and reference on buffers, files, sockets, datagrams, and pipe channels as found in the Java I/O, NIO, and NIO. 2 reference implementations. In this book, you'll also learn how and when to use selectors, regular expressions, including patterns, matchers and more. You'll learn how to work with Charsets, formatters and scanners. You'll - all in all - learn how to use and apply NIO, NIO. 2 and the enhancements available. After reading and using this book, you'll gain the accelerated knowledge and skill level to really build applications with efficient data access, especially for today's cloud computing streaming data needs
دانلود کتاب Java I/O, NIO and NIO. 2