Raw Bytes

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page        

Answer:

Yes; the example program did this.

Raw Bytes

As far as the IO system and hard disk are concerned, the program sends a stream of bytes and they are stored on the disk, one after another. There is no concept (at the electronic level) of "int" or "double" or "char". Its all "bytes" to the electronics. The example program did this:

dataOut.writeInt( 0 );
dataOut.writeDouble( 12.45 );

A hex dump shows the 12 bytes. Remember that dumps such as this print two characters to show the pattern in one byte.

The six zeros at the beginning of the line mean the the first byte shown is byte zero of the file. The f's the end of the line show that some bit patterns of the double could also be interpreted as characters.

QUESTION 14:

Is it possible to tell just by looking at the bytes in a file what types the data are?