public PrettyPrintUtility() {
    	try {
			writer = new PrintWriter(new FileWriter(new File("Log.txt"), true));
            writer.println(">> opened Log FILE");
            writer.println(">> started PrettyPrintUtility");
            namesIn = new DataInputStream(new BufferedInputStream(
                                          new FileInputStream(names)));
            writer.println(">> opened NameIndexBackup FILE");
            recsIn = new DataInputStream(new BufferedInputStream(
                                         new FileInputStream(recs)));
            writer.println(">> opened MainData FILE\n");
		} catch (IOException e) {}

        try {
            writer.println("MAIN DATA FILE");
            writer.println("N is " + recsIn.readShort());
            writer.println("RRN>ID CODE NAME----------- CONTINENT---- ------AREA"
                          + " INDEP ---POPULATION L.EX ------GNP");
            try {
                while (true) {
                    record = new RawDataRecord();

                    id = recsIn.readShort();
                    writer.print(fmt.format(id) + ">" + fmt.format(id) + " ");

                    byte[] code = new byte[3];
                    recsIn.read(code);
                    record.setCode(new String(code));
                    
                    byte[] name = new byte[15];
                    recsIn.read(name);
                    record.setName(new String(name));
                    
                    byte[] continent = new byte[13];
                    recsIn.read(continent);
                    record.setContinent(new String(continent));
                    
                    record.setSurfaceArea(recsIn.readInt());
                    record.setYearOfIndep(recsIn.readShort());
                    record.setPopulation(recsIn.readLong());
                    record.setLifeExp(recsIn.readFloat());
                    record.setGnp(recsIn.readInt());

                    writer.println(record);
                }
            } catch (EOFException e) {
                writer.println("@ @ @ @ @ @ @ @ @ END OF FILE @ @ @ @ @ @ @ @\n");
                writer.println(">> closed MainData FILE");
                recsIn.close();
            }
        } catch (IOException e) {}

        try {
            writer.println("\nNAME INDEX");
        	writer.println("N is " + namesIn.readShort() + ", MaxID is "
                           + namesIn.readShort() + ", RootPtr is "
                           + namesIn.readShort());
        	writer.println("[SUB]\t- - - Name - - - - - - - - -\tDRP\tLCh\tRCh");

            int i = 0;
        	try { // print each record
                while (true) {
            		String name = namesIn.readUTF(); // cut names that are too long
            		if(name.length() > 28) name = name.substring(0, 28);

            		writer.print("[" + fmt.format(i++) + "]\t" + name);
            		for(int j = 0; j < 4 - (name.length() / 8); j++) {
            			writer.print("\t"); // print correct # of tabs
            		}
            		writer.println(fmt.format(namesIn.readShort()) + "\t"
            					   + fmt.format(namesIn.readShort()) + "\t"
            					   + fmt.format(namesIn.readShort()));
                }
        	} catch (EOFException e) {
                writer.println("@ @ @ @ @ @ @ @ @ END OF FILE @ @ @ @ @ @ @ @\n");
                writer.println(">> closed NameIndexBackup FILE");
                namesIn.close();
            }
        } catch (IOException e) {}

        writer.println(">> ended PrettyPrintUtility");
        writer.println(">> closed Log FILE");
    	writer.close(); // close files
    }