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

Answer:

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


Binary File

I/O hierarchy

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 intended to represent 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.

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 use bit patterns to encode data other than characters. They encode information about font, formats, graphics, pictures, and other non-character data.

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


QUESTION 2:

Can the 32 bits in an int variable be written directly to a binary file without first translating into characters?


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