/** * Converts hc.txt to hc.dat for hits count applet hc.class * @author Robert John Morton UK-YE572246C * @version 27 April 2000 */ // This program uses the Java 1.1.8 API. import java.io.*; class hctxtdat { public static void main(String args[]) throws IOException { BufferedReader r = new BufferedReader( new InputStreamReader( new FileInputStream("hc.txt") ) ); DataOutputStream w = new DataOutputStream( new FileOutputStream("hc.dat") ); String s; int x; while((s = r.readLine()) != null) { // read in the next line of text int l = s.length(); // get its length if (l > 8) // if more than 8 characters then it is a valid entry x = Integer.parseInt(s.substring(8,l)); // extract number of hits for that week else // else it is a null entry x = -1; // indicates a null entry w.writeByte(x); // write the integer as a single signed byte value } w.close(); r.close(); } }