/* * BinaryFileAccessor.java * * This program reads back the file created by BinaryFileMaker.java.  See * that program for a description of the file * * Copyright (c) 2000, 2004 - Russell C. Bjork * */import java.io.*;import javax.swing.*;public class BinaryFileAccessor{    public static void main(String [] args) throws IOException    {        // Open the file        		File filename;		JFileChooser chooser = new JFileChooser(System.getProperty("user.dir"));		if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION)		{			filename = chooser.getSelectedFile();		}		else			return;			        DataInputStream input = new DataInputStream(        	new FileInputStream(filename));                // Read the values from the file                boolean booleanValue = input.readBoolean();        char charValue = input.readChar();        byte byteValue = input.readByte();        short shortValue = input.readShort();        int intValue = input.readInt();        long longValue = input.readLong();        float floatValue = input.readFloat();        double doubleValue = input.readDouble();        int stringLength = input.readInt();        String stringValue = "";        for (int i = 0; i < stringLength; i ++)        	stringValue += input.readChar();        		// Write out what we read				System.out.println(booleanValue);		System.out.println(charValue);		System.out.println(byteValue);		System.out.println(shortValue);		System.out.println(intValue);		System.out.println(longValue);		System.out.println(floatValue);		System.out.println(doubleValue);		System.out.println(stringValue);		        // Close the file and we're done                input.close();        System.exit(0);    }}        