Java IO Package Overview


Introduction

A thorough understanding of file input and output programming is an essential skill you must possess to create complex programs that store and retrieve object or program state information to and from auxiliary storage devices. Luckily, Java makes file I/O programming easy with the classes provided in the java.io package.

The purpose of this chapter is to show you how to write and read bytes, characters, Java primitive types, and objects to and from files. Along the way you will learn how to select and use the appropriate java.io classes for the file I/O task at hand.

This chapter starts with an overview of the primary classes of the java.io package. Although I will not show you how to use every class in the java.io package you will have a good understanding of how the java.io package is organized when you complete this chapter. This knowledge will make it easy for you to find the right java.io class when the need arises.

The primary programming example will show you how to write a Java adapter that accesses a legacy application flat-file data store. The example will demonstrate the use of the RandomAccessFile class in the manipulation of fixed-length record fields.

To understand the material in this chapter you should be thoroughly familiar with the concepts presented in chapters 1 through 11, 15, & 16.

Although the focus of this chapter is on using the java.io package to perform file I/O, everything you learn here regarding the use of InputStreams, OutputStreams, Readers, and Writers, can be applied when you need to perform network-based I/O.




Java For Artists(c) The Art, Philosophy, and Science of Object-Oriented Programming
Java For Artists: The Art, Philosophy, And Science Of Object-Oriented Programming
ISBN: 1932504052
EAN: 2147483647
Year: 2007
Pages: 452

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net