1. Trang chủ
  2. » Công Nghệ Thông Tin

OReilly java IO 2nd edition may 2006 ISBN 0596527500

1.3K 241 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Java™ I/O, 2nd Edition By Elliotte Rusty Harold Publisher: O'Reilly Pub Date: May 2006 Print ISBN-10: 0-596-52750-0 Print ISBN-13: 978-0-59-652750-1 Pages: 726 Table of Contents | Index All of Java's Input/Output (I/O) facilities are based on streams, which provide simple ways to read and write data of different types Java provides many different kinds of streams, each with its own application The universe of streams is divided into four large categories: input streams and output streams, for reading and writing binary data; and readers and writers, for reading and writing textual (character) data You're almost certainly familiar with the basic kinds of streams but did you know that there's a CipherInputStream for reading encrypted data? And a ZipOutputStream for automatically compressing data? Do you know how to use buffered streams effectively to make your I/O operations more efficient? Java I/O, 2nd Edition has been updated for Java 5.0 APIs and tells you all you ever need to know about streams and probably more A discussion of I/O wouldn't be complete without treatment of character sets and formatting Java supports the UNICODE standard, which provides definitions for the character sets of most written languages Consequently, Java is the first programming language that lets you do I/O in virtually any language Java also provides a sophisticated model for formatting textual and numeric data Java I/O, 2nd Edition shows you how to control number formatting, use characters aside from the standard (but outdated) ASCII character set, and get a head start on writing truly multilingual software Java I/O, 2nd Edition includes: Coverage of all I/O classes and related classes In-depth coverage of Java's number formatting facilities and its support for International character sets Java™ I/O, 2nd Edition By Elliotte Rusty Harold Publisher: O'Reilly Pub Date: May 2006 Print ISBN-10: 0-596-52750-0 Print ISBN-13: 978-0-59-652750-1 Pages: 726 Table of Contents | Index Copyright Preface Part PART I: Basic I/O Chapter 1 Introducing I/O Section 1.1 What Is a Stream? Section 1.2 Numeric Data Section 1.3 Character Data Section 1.4 Readers and Writers Section 1.5 Buffers and Channels Section 1.6 The Ubiquitous IOException Section 1.7 The Console: System.out, System.in, and System.err Section 1.8 Security Checks on I/O Chapter 2 Output Streams Section 2.1 Writing Bytes to Output Streams Section 2.2 Writing Arrays of Bytes Section 2.3 Closing Output Streams Section 2.4 Flushing Output Streams Section 2.5 Subclassing OutputStream Section 2.6 A Graphical User Interface for Output Streams Chapter 3 Input Streams Section 3.1 The read( ) Method Section 3.2 Reading Chunks of Data from a Stream Section 3.3 Counting the Available Bytes Section 3.4 Skipping Bytes Section 3.5 Closing Input Streams Section 3.6 Marking and Resetting Section 3.7 Subclassing InputStream Section 3.8 An Efficient Stream Copier Part PART II: Data Sources Chapter 4 File Streams Section 4.1 Reading Files Section 4.2 Writing Files Section 4.3 File Viewer, Part 1 Chapter 5 Network Streams Section 5.1 URLs Section 5.2 URL Connections Section 5.3 Sockets Section 5.4 Server Sockets Section 5.5 URLViewer Part PART III: Filter Streams Chapter 6 Filter Streams Section 6.1 The Filter Stream Classes Section 6.2 The Filter Stream Subclasses Section 6.3 Buffered Streams Section 6.4 PushbackInputStream Section 6.5 ProgressMonitorInputStream Section 6.6 Multitarget Output Streams Section 6.7 File Viewer, Part 2 Chapter 7 Print Streams Section 7.1 Print Versus Write Section 7.2 Line Breaks Section 7.3 Error Handling Section 7.4 printf( ) Section 7.5 Formatter Section 7.6 Formattable Chapter 8 Data Streams Section 8.1 The Data Stream Classes Section 8.2 Integers Section 8.3 Floating-Point Numbers Section 8.4 Booleans Section 8.5 Byte Arrays Section 8.6 Strings and chars Section 8.7 Little-Endian Numbers Section 8.8 Thread Safety Section 8.9 File Viewer, Part 3 Chapter 9 Streams in Memory Section 9.1 Sequence Input Streams Section 9.2 Byte Array Streams Section 9.3 Communicating Between Threads Using Piped Streams Chapter 10 Compressing Streams Section 10.1 Inflaters and Deflaters Section 10.2 Compressing and Decompressing Streams Section 10.3 Zip Files Section 10.4 Checksums Section 10.5 File Viewer, Part 4 Chapter 11 JAR Archives Section 11.1 Meta-Information: Manifest Files and Signatures Section 11.2 The jar Tool Section 11.3 The java.util.jar Package Section 11.4 JarFile Section 11.5 JarEntry Section 11.6 Attributes Section 11.7 Manifest Section 11.8 JarInputStream Section 11.9 JarOutputStream Section 11.10 JarURLConnection Section 11.11 Pack200 Section 11.12 Reading Resources from JAR Files Chapter 12 Cryptographic Streams Section 12.1 Hash Functions Section 12.2 The MessageDigest Class Section 12.3 Digest Streams Section 12.4 Encryption Basics Section 12.5 The Cipher Class Section 12.6 Cipher Streams Section 12.7 File Viewer, Part 5 Chapter 13 Object Serialization Section 13.1 Reading and Writing Objects Section 13.2 Object Streams Section 13.3 How Object Serialization Works Section 13.4 Performance Section 13.5 The Serializable Interface Section 13.6 Versioning Section 13.7 Customizing the Serialization Format Section 13.8 Resolving Classes Section 13.9 Resolving Objects Section 13.10 Validation Section 13.11 Sealed Objects Section 13.12 JavaDoc Part PART IV: New I/O Chapter 14 Buffers Section 14.1 Copying Files with Buffers Section 14.2 Creating Buffers Section 14.3 Buffer Layout Section 14.4 Bulk Put and Get Section 14.5 Absolute Put and Get Section 14.6 Mark and Reset Section 14.7 Compaction Section 14.8 Duplication Section 14.9 Slicing Section 14.10 Typed Data Section 14.11 Read-Only Buffers Section 14.12 CharBuffers Section 14.13 Memory-Mapped I/O Chapter 15 Channels Section 15.1 The Channel Interfaces Section 15.2 File Channels Section 15.3 Converting Between Streams and Channels Section 15.4 Socket Channels Section 15.5 Server Socket Channels Section 15.6 Datagram Channels Chapter 16 Nonblocking I/O Section 16.1 Nonblocking I/O Section 16.2 Selectable Channels Section 16.3 Selectors Section 16.4 Selection Keys Section 16.5 Pipe Channels Part PART V: The File System Chapter 17 Working with Files Section 17.1 Understanding Files Section 17.2 Directories and Paths Section 17.3 The File Class Section 17.4 Filename Filters Section 17.5 File Filters Section 17.6 File Descriptors Section 17.7 Random-Access Files Section 17.8 General Techniques for Cross-Platform File Access Code Chapter 18 File Dialogs and Choosers Section 18.1 File Dialogs Section 18.2 JFileChooser Section 18.3 File Viewer, Part 6 Part PART VI: Text Chapter 19 Character Sets and Unicode Section 19.1 The Unicode Character Set Section 19.2 UTF-16 Section 19.3 UTF-8 Section 19.4 Other Encodings Section 19.5 Converting Between Byte Arrays and Strings Chapter 20 Readers and Writers Section 20.1 The java.io.Writer Class Section 20.2 The OutputStreamWriter Class Section 20.3 The java.io.Reader Class Section 20.4 The InputStreamReader Class Section 20.5 Encoding Heuristics Section 20.6 Character Array Readers and Writers Section 20.7 String Readers and Writers Section 20.8 Reading and Writing Files Section 20.9 Buffered Readers and Writers Section 20.10 Print Writers Section 20.11 Piped Readers and Writers Section 20.12 Filtered Readers and Writers Section 20.13 File Viewer Finis Chapter 21 Formatted I/O with java.text Section 21.1 The Old Way Section 21.2 Choosing a Locale Section 21.3 Number Formats Section 21.4 Specifying Width with FieldPosition Section 21.5 Parsing Input Section 21.6 Decimal Formats Part PART VII: Devices Chapter 22 The Java Communications API Section 22.1 The Architecture of the Java Communications API Section 22.2 Identifying Ports Section 22.3 Communicating with a Device on a Port Section 22.4 Serial Ports Section 22.5 Parallel Ports Chapter 23 USB Section 23.1 USB Architecture Section 23.2 Finding Devices Section 23.3 Controlling Devices Section 23.4 Describing Devices Section 23.5 Pipes Section 23.6 IRPs Section 23.7 Temperature Sensor Example Section 23.8 Hot Plugging Chapter 24 The J2ME Generic Connection Framework Section 24.1 The Generic Connection Framework Section 24.2 ContentConnection Section 24.3 Files Section 24.4 HTTP Section 24.5 Serial I/O Section 24.6 Sockets Section 24.7 Server Sockets Section 24.8 Datagrams Chapter 25 Bluetooth Section 25.1 The Bluetooth Protocol Section 25.2 The Java Bluetooth API Section 25.3 The Local Device Section 25.4 Discovering Devices Section 25.5 Remote Devices Section 25.6 Service Records Section 25.7 Talking to Devices Part PART VIII: Appendix Character Sets About the Author Colophon Colophon Index Java™ I/O, 2nd Edition by Elliotte Rusty Harold Copyright © 2006 O'Reilly Media, Inc All rights reserved Printed in the United States of America Published by O'Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O'Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (safari.oreilly.com) For more information, contact our corporate/institutional sales department: (800) 998-9938 or corporate@oreilly.com Editor: Deb Cameron Developmental Editor: Mike Loukides Production Editor: Philip Dangler Copyeditor: Rachel Wheeler Proofreader: Lydia Onofrei Indexer: Johnna VanHoose Dinse Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrators: Robert Romano and Jessamyn Read Printing History: March 1999: First Edition May 2006: Second Edition Nutshell Handbook, the Nutshell Handbook logo, and the O'Reilly logo are registered trademarks of O'Reilly Media, Inc Java I/O, Second Edition, the image of a rabbit, and related trade dress are trademarks of O'Reilly Media, Inc Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries O'Reilly Media, Inc is independent of Sun Microsystems, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O'Reilly Media, Inc was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 0-596-52750-0 [M] Preface In many ways, this book is a prequel to my previous book, Java Network Programming (O'Reilly) When writing that book, I more or less assumed that readers were familiar with basic input and output in Java™that they knew how to use input streams and output streams, convert bytes to characters, connect filter streams to each other, and so forth However, after that book was published, I began to notice that a lot of the questions I got from readers weren't as much about network programming itself as they were about input and output (I/O in programmer vernacular) When Java 1.1 was released with a vastly expanded java.io package and many new I/O classes spread out across the rest of the class library, it became obvious that a book that specifically addressed I/O was required This is that book More specifically, it is that book updated and expanded to cover the even more impressive I/O capabilities introduced in Java 1.4, 5, and 6 The I/O class libraries in Java are more powerful and interesting than ever, and this book shows you how to take full advantage of them Techniques you'll learn here include: Reading and writing files Communicating over network sockets Filtering data Interpreting a wide variety of formats for integer and floating-point numbers Passing data between threads repositioning precision in number formats preventing serialization print streams character sets error handling format( ) method Formatter constructor line breaks printf( ) method println( ) method write( ) method print writers print( ) method printf( ) method 2nd println( ) method print streams PrintStream class IOException and PrintWriter class IOException and ProgressMonitorInputStream class PushbackInputStream class 2nd PushbackReader class put type methods, I/O Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] random access file channels random-access files RandomAccessFile class read( ) method reading from streams read-only buffers read-only method ReadableByteChannel interface readBoolean( ) method readChar( ) method readDouble( ) method readers buffers channels, converting from filtered piped strings writers readFloat( ) method reading data, URL connections reading files 2nd reading from files, JAR files reading from streams reading objects reading text readLine( ) method readObject( ) method readResolve( ) method register( ) method relative paths remote devices, Bluetooth RemoteDevice class renameTo( ) method Request To Send (RTS) reset( ) method 2nd resetting position, input stream resolveClass( ) resolving classes, serialization resolving objects, serialization RFCOMM devices, Bluetooth root hub, USB controller RTS (Request To Send) Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] scanf( ) scattering channels ScatteringByteChannel interface scatternets SDU sealed objects SealedObject class security selectable channels, NIO SelectableChannel class SelectionKey class Selector class Selector.open( ) method sequence SequenceInputStream serial I/O, GCF serial ports control functions control wires DTR events flow control parity RTS SerialPort class serializable interface serialization class resolution defaultReadObject( ) method defaultWriteObject( ) method Externalizable interface format, custom javadoc object resolution objects, sealed overview performance and preventing reading objects readObject( ) method readResolve( ) method serialPersistentFields validation and versioning and changes SUIDs writeObject( ) method writeReplace( ) method writing objects serialPersistentFields array SerialPort class SerialPortEvent SerialPortEventListener server sockets 2nd ServerSocket object ServerSocketChannel class service records, Bluetooth ServiceRecord interface setDictionary( ) methods setFilenameFilter() setLastModified( ) method setReadOnly( ) method short integer skip( ) method skipBytes( ) method skipping bytes slicing buffers SocketChannel class SocketConnection interface sockets 2nd getters options server sockets 2nd stream ciphers, encryption StreamCopier class streams byte array input streams byte array output streams byte array streams byte array input streams byte array output streams channels converting from converting to checksums compression DeflaterOutputStream class GZIPInputStream class GZIPOutputStream class copying decompression InflaterInputStream class definition digest streams file input file output input, compression network connections object streams objects, writing to stream origins output, expanding piped streams reading from streams classes String class byte arrays and Charset class StringBufferInputStream class StringReader class strings arrays, converting between readers writers subclasses, filter streams subclassing SUIDs (stream unique identifiers) SunJCE Swing symmetric ciphers, encryption system properties System.err 2nd 3rd redirection System.in 2nd 3rd redirection System.out 2nd 3rd redirection Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] temperature sensor example, USB temporary files text reading writing thread safety threading, file channels transferFrom( ) method transferTo( ) method tryLock( ) method typed data, I/O Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] UDP data, packets Unicode blocks characters (0127) fonts Unicode data update( ) method checksums Cipher class URL objects URLConnection object URLs connections reading data writing data datagram URLs HTTP, getter methods URLViewer USB architecture controller, root hub devices configuration controlling describing locating hot plugging IRPs pipes temperature sensor example USB (Universal Serial Bus) USB API USB controllers functions UsbConfigurationDescriptor interface UsbDevice interface UsbDeviceDescriptor interface UsbEndpoints interface UsbInterface interface UsbInterfaceDescriptor interface UsbServicesListener interface UTF-16 UTF-8 UUIDs (Universal Unique Identifiers), Bluetooth Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] validation, serialization and versioning, serialization and changes SUIDs view buffers viewing files Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] width, Formatter class Win32 systems file attributes paths, separators working directory, current WritableByteChannel interface write( ) method 2nd 3rd 4th print streams writeBytes( ) method 2nd 3rd writeChar( ) method writeChars( ) writeChars( ) method 2nd writeDouble( ) method writeFloat( ) method writeIn( ) method writeObject( ) method writeReplace( ) method writers buffers channels, converting from filtered piped print writers strings writeUTF( ) method writing arrays of bytes bytes to output streams to files writing data, URL connections writing objects writing text Index [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [R] [S] [T] [U] [V] [W] [Z] zip files JAR files, versus ZipEntry objects ZipInputStream class JarInputStream subclass ZipOutputStream class JarOutputStream subclass ... Section 13.6 Versioning Section 13.7 Customizing the Serialization Format Section 13.8 Resolving Classes Section 13.9 Resolving Objects Section 13.10 Validation Section 13.11 Sealed Objects Section 13.12... Absolute Put and Get Section 14.6 Mark and Reset Section 14.7 Compaction Section 14.8 Duplication Section 14.9 Slicing Section 14.10 Typed Data Section 14.11 Read-Only Buffers Section 14.12 CharBuffers Section 14.13... The J2ME Generic Connection Framework Section 24.1 The Generic Connection Framework Section 24.2 ContentConnection Section 24.3 Files Section 24.4 HTTP Section 24.5 Serial I/O Section 24.6 Sockets Section 24.7

Ngày đăng: 26/03/2019, 16:31

Xem thêm:

TỪ KHÓA LIÊN QUAN

Mục lục

    Java™ I/O, 2nd Edition

    Part PART I: Basic I/O

    Section 1.1. What Is a Stream?

    Section 1.8. Security Checks on I/O

    Section 2.1. Writing Bytes to Output Streams

    Section 2.2. Writing Arrays of Bytes

    Section 2.6. A Graphical User Interface for Output Streams

    Section 3.2. Reading Chunks of Data from a Stream

    Section 3.3. Counting the Available Bytes

    Section 3.8. An Efficient Stream Copier

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN