Java™ I/O

Elliotte Rusty Harold

Publisher: O'Reilly, 1999, 568 pages

ISBN: 1-56592-485-1

Keywords: Java

Last modified: July 30, 2021, 10:54 p.m.

Input and output are essential but often ignored part of programming. Without I/O, programs can do little more than spin their wheels. They can calculate, but they can't tell anyone their results. Unfortunately, most books don't take you much beyond the most basic System.out.println()-style I/O. Java I/O shows you the advanced I/O tricks and techniques used by the wizards and gurus of the Java world.

Java's I/O facilities are extraordinarily flexible and simple to use, and provides everything that's available in C, C++, and many other programming languages, including binary and text output, console access, network sockets, serial and parallel port communication, and precise formatting of numbers. However, Java uses a filter-based approach to I/O that's unfamiliar to many programmers and require some basic rethinking of how I/O operates. Once grasped, the Java I/O package is far simpler, more flexible, and more powerful than the I/O facilities of any other common language.

You're probably familiar with the basic kinds of streams: but do you know that there's a CipherInputStream for reading encrypted data? And a ZipOutputStream for compressing data?Do you know how to use buffered streams effectively to make yourI/O operations more efficient? Do you know how to use readers, writers, and format objects to internationalize your software? Java I/O shows you how to put Java's I/O classes to work.

  1. Basic I/O
    1. Introducing I/O
      • What Is a Stream?
      • Numeric Data
      • Character Data
      • readers and Writers
      • The Ubiquitous IOException
      • The Console: System.out, System,in, and System.err
      • Security Checks on I/O
    2. Output Streams
      • The OutputStream Class
      • Writing Bytes to Output Streams
      • Writing Arrays of Bytes
      • Flushing and Closing Output Streams
      • Subclassing OutputStream
      • A Graphical User Interface for Output Streams
    3. Input Streams
      • The InoutStream Class
      • 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
  2. Data Sources
    1. File Streams
      • Reading Files
      • Writing Files
      • File Viewer, Part 1
    2. Network Streams
      • URLs
      • URL Connections
      • Sockets
      • Server Sockets
      • URLViewer
  3. Filter Streams
    1. Filter Streams
      • The Filter Stream Classes
      • The Filter Stream Subclasses
      • Buffered Streams
      • PushbackInputStream
      • Print Streams
      • Multitarget Output Streams
      • File Viewer, Part 2
    2. Data Streams
      • The Data Stream Classes
      • Reading and Writing Integers
      • Reading and Writing Floating-Point Numbers
      • Reading and Writing Booleans
      • Reading Byte Arrays
      • Reading and Writing Text
      • Miscellaneous Methods
      • Reading and Writing Little-Endian Numbers
      • Thread Safety
      • File Viewer, Part 3
    3. Streams in Memory
      • Sequence Input Streams
      • Byte Array Streams
      • Communicating Between Threads with Piped Streams
    4. Compressing Streams
      • Inflaters and Deflaters
      • Compressing and Decompressing Streams
      • Working with Zip Files
      • Checksums
      • JAR Files
      • File Viewer, Part 4
    5. Cryptographic Streams
      • Hash Function Basics
      • The MessageDigest Class
      • Digest Streams
      • Encryption Basics
      • The Cipher Class
      • Cipher Streams
      • File Viewer, Part 5
  4. Advanced and Miscellaneous Topics
    1. Object Serialization
      • Reading and Writing Objects
      • Object Streams
      • How Object Serialization Works
      • Performance
      • The Serializable Interface
      • The ObjectInput and ObjectOutput Interfaces
      • Versioning
      • Customizing the Serialization Interface
      • Resolving Classes
      • Resolving Objects
      • Validation
      • Sealed Objects
    2. 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
    3. File Dialogs and Choosers
      • File Dialogs
      • JFileChooser
      • File Viewer, Part 6
    4. Multilingual Character Sets and Unicode
      • Unicode
      • Displaying Unicode Text
      • Unicode Escapes
      • UTF-8
      • The char Data Type
      • Other Encodings
      • Converting Between Byte Arrays and Strings
    5. Readers and Writers
      • The java.io.Writer Class
      • The OutputStreamWriter Class
      • The java.io.Reader Class
      • The InputStreamReader Class
      • 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
    6. Formatted I/O with java.text
      • The Old Way
      • Choosing a Locale
      • Number Formats
      • Specifying Width with FieldPosition
      • Parsing Input
      • Decimal Formats
      • An Exponential Number Format
    7. The Java Communications API
      • The Architecture of the Java Communications API
      • Identifying Ports
      • Communicating with a Device on a Port
      • Serial Ports
      • Parallel Ports
  5. Appendixes
    1. Additional Resources
    2. Character Sets

Reviews

Java I/O

Reviewed by Roland Buresund

Bad ** (2 out of 10)

Last modified: Nov. 15, 2008, 11:06 a.m.

I fail to see the revolutionary with Java's I/O System.

The author seems to have a chip on his shoulder, and starts out by counter-attacking everyone else that doesn't love Java :-)

After having explained that Java is extremely powerful and very easy to use, he sets out a journey of going through a number of I/O subsystems very superficially. In the process. he in fact manages to contradict his own claims of ease-of-use and fails to show the power in the I/O systems, as implemented by Java (to the reader).

Sigh, it's just crap.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required