Description
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 I/O, 2nd Edition tells you all you need to know about the four main categories of streams and uncovers less-known features to help make your I/O operations more efficient. You'll also learn how to control number formatting, use characters aside from the standard ASCII character set, and get a head start on writing truly multilingual software.
Full Description
Table of Contents
-
Basic I/O
-
Chapter 1 Introducing I/O
- What Is a Stream?
- Numeric Data
- Character Data
- Readers and Writers
- Buffers and Channels
- The Ubiquitous IOException
- The Console: System.out, System.in, and System.err
- Security Checks on I/O
-
Chapter 2 Output Streams
- Writing Bytes to Output Streams
- Writing Arrays of Bytes
- Closing Output Streams
- Flushing Output Streams
- Subclassing OutputStream
- A Graphical User Interface for Output Streams
-
Chapter 3 Input Streams
- The read( ) Method
- Reading Chunks of Data from a Stream
- Counting the Available Bytes
- Skipping Bytes
- Closing Input Streams
- Marking and Resetting
- Subclassing InputStream
- An Efficient Stream Copier
-
-
Data Sources
-
Chapter 4 File Streams
- Reading Files
- Writing Files
- File Viewer, Part 1
-
Chapter 5 Network Streams
- URLs
- URL Connections
- Sockets
- Server Sockets
- URLViewer
-
-
Filter Streams
-
Chapter 6 Filter Streams
- The Filter Stream Classes
- The Filter Stream Subclasses
- Buffered Streams
- PushbackInputStream
- ProgressMonitorInputStream
- Multitarget Output Streams
- File Viewer, Part 2
-
Chapter 7 Print Streams
- Print Versus Write
- Line Breaks
- Error Handling
- printf( )
- Formatter
- Formattable
-
Chapter 8 Data Streams
- The Data Stream Classes
- Integers
- Floating-Point Numbers
- Booleans
- Byte Arrays
- Strings and chars
- Little-Endian Numbers
- Thread Safety
- File Viewer, Part 3
-
Chapter 9 Streams in Memory
- Sequence Input Streams
- Byte Array Streams
- Communicating Between Threads Using Piped Streams
-
Chapter 10 Compressing Streams
- Inflaters and Deflaters
- Compressing and Decompressing Streams
- Zip Files
- Checksums
- File Viewer, Part 4
-
Chapter 11 JAR Archives
- Meta-Information: Manifest Files and Signatures
- The jar Tool
- The java.util.jar Package
- JarFile
- JarEntry
- Attributes
- Manifest
- JarInputStream
- JarOutputStream
- JarURLConnection
- Pack200
- Reading Resources from JAR Files
-
Chapter 12 Cryptographic Streams
- Hash Functions
- The MessageDigest Class
- Digest Streams
- Encryption Basics
- The Cipher Class
- Cipher Streams
- File Viewer, Part 5
-
Chapter 13 Object Serialization
- Reading and Writing Objects
- Object Streams
- How Object Serialization Works
- Performance
- The Serializable Interface
- Versioning
- Customizing the Serialization Format
- Resolving Classes
- Resolving Objects
- Validation
- Sealed Objects
- JavaDoc
-
-
New I/O
-
Chapter 14 Buffers
- Copying Files with Buffers
- Creating Buffers
- Buffer Layout
- Bulk Put and Get
- Absolute Put and Get
- Mark and Reset
- Compaction
- Duplication
- Slicing
- Typed Data
- Read-Only Buffers
- CharBuffers
- Memory-Mapped I/O
-
Chapter 15 Channels
- The Channel Interfaces
- File Channels
- Converting Between Streams and Channels
- Socket Channels
- Server Socket Channels
- Datagram Channels
-
Chapter 16 Nonblocking I/O
- Nonblocking I/O
- Selectable Channels
- Selectors
- Selection Keys
- Pipe Channels
-
-
The File System
-
Chapter 17 Working with Files
- Understanding Files
- Directories and Paths
- The File Class
- Filename Filters
- File Filters
- File Descriptors
- Random-Access Files
- General Techniques for Cross-Platform File Access Code
-
Chapter 18 File Dialogs and Choosers
- File Dialogs
- JFileChooser
- File Viewer, Part 6
-
-
Text
-
Chapter 19 Character Sets and Unicode
- The Unicode Character Set
- UTF-16
- UTF-8
- Other Encodings
- Converting Between Byte Arrays and Strings
-
Chapter 20 Readers and Writers
- The java.io.Writer Class
- The OutputStreamWriter Class
- The java.io.Reader Class
- The InputStreamReader Class
- Encoding Heuristics
- Character Array Readers and Writers
- String Readers and Writers
- Reading and Writing Files
- Buffered Readers and Writers
- Print Writers
- Piped Readers and Writers
- Filtered Readers and Writers
- File Viewer Finis
-
Chapter 21 Formatted I/O with java.text
- The Old Way
- Choosing a Locale
- Number Formats
- Specifying Width with FieldPosition
- Parsing Input
- Decimal Formats
-
-
Devices
-
Chapter 22 The Java Communications API
- The Architecture of the Java Communications API
- Identifying Ports
- Communicating with a Device on a Port
- Serial Ports
- Parallel Ports
-
Chapter 23 USB
- USB Architecture
- Finding Devices
- Controlling Devices
- Describing Devices
- Pipes
- IRPs
- Temperature Sensor Example
- Hot Plugging
-
Chapter 24 The J2ME Generic Connection Framework
- The Generic Connection Framework
- ContentConnection
- Files
- HTTP
- Serial I/O
- Sockets
- Server Sockets
- Datagrams
-
Chapter 25 Bluetooth
- The Bluetooth Protocol
- The Java Bluetooth API
- The Local Device
- Discovering Devices
- Remote Devices
- Service Records
- Talking to Devices
-
-
Appendix
-
Appendix Character Sets
-
-
About the Author
-
Colophon
Product Details
- Title:
- Java I/O, Second Edition
- By:
- Elliotte Rusty Harold
- Publisher:
- O'Reilly Media
- Formats:
-
- Safari Books Online
- Print Release:
- May 2006
- Pages:
- 736
- Print ISBN:
- 978-0-596-52750-1
- | ISBN 10:
- 0-596-52750-0
Customer Reviews
