10: The Java IO system | CodeGuru

10: The Java IO system

Bruce Eckel’s Thinking in Java Contents | Prev | Next IO system Creating a good input/output (IO) system is one of the more difficult tasks for the language designer. This is evidenced by the number of different approaches. The challenge seems to be in covering all eventualities. Not only are there different kinds of IO […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 1, 2001
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

IO
system

Creating


a good input/output (IO) system is one of the more difficult tasks for the


language designer.

This


is evidenced by the number of different approaches. The challenge seems to be


in covering all eventualities. Not only are there different kinds of IO that


you want to communicate with (files, the console, network connections), but you


need to talk to them in a wide variety of ways (sequential, random-access,


binary, character, by lines, by words, etc.).

The


Java library designers attacked the problem by creating lots of classes. In


fact, there are so many classes for Java’s IO system that it can be


intimidating at first (ironically, the Java IO design actually prevents an


explosion of classes). There has also been a significant change in the IO

library
between Java 1.0

and Java 1.1
.
Instead of simply replacing the old library with a new one, the designers at
Sun extended the old library and added the new one alongside it. As a result
you can sometimes end up mixing the old and new libraries and creating even
more intimidating code.

This


chapter will help you understand the variety of IO classes in the standard Java


library and how to use them. The first portion of the chapter will introduce


the “old” Java 1.0


IO stream library, since there is a significant amount of existing code that
uses that library. The remainder of the chapter will introduce the new features
in the Java 1.1 IO library. Note that when you compile some of the code in the
first part of the chapter with a Java 1.1 compiler you can get a “
deprecated
feature” warning message at compile time. The code still works; the
compiler is just suggesting that you use certain new features that are
described in the latter part of this chapter. It is valuable, however, to see
the difference between the old and new way of doing things and that’s why
it was left in – to increase your understanding (and to allow you to read
code written for Java 1.0
). Contents

|

Prev

|

Next
CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.