go to previous page   go to home page   go to next page        

Answer:

256, which is 28 (2 to the 8th power).

Binary File

Of course, fundamentally all files consist of 8-bit bytes. As far as the computer's electronics are concerned, all files look alike. The electronics of the hard drive, the hard drive controller, and the bus that connects them to the rest of the computer system are concerned only with storing and retrieving bytes. They move bytes back and forth between components without concern about what the bytes mean.

But software makes a distinction between types of files. Those files that contain bytes which are interpreted as characters are called "text files". All other files are called "binary files". You may wish to look again at Chapter Two to review the ideas of bit patterns and representation.

IO hierarchy

The terms "text file" and "binary file" are somewhat misleading. For example, a word processor file is a "binary file". This is because many of the bytes in a word processor file are interpreted as font, formatting, graphics, and other non-character information. These bytes use all 256 patterns.

The picture shows the top of the IO stream hierarchy. This chapter will look at the OutputStream class.

QUESTION 2:

Can a value from an int variable be written to a binary file without first translating it into characters?