public void run(){
        DataInputStream br = new DataInputStream(inFile);
        PrintWriter pw = new PrintWriter(new OutputStreamWriter(outFile));
        try {
            while(!suspending) {
                //calculate the number of words in each line
                String line = br.readLine();
                String arr[] = line.split(" ");
                String re = "Line " + lineNum++ + ": " + arr.length;
                total+=arr.length;
                pw.write(re);
                pw.println();
                System.out.println(re);
                Thread.sleep(1000);
            }
            pw.write("Total: ");
            pw.println(total);
        }
        catch (InterruptedException e) {}
        catch(NullPointerException e){
            pw.write("Total: ");
            pw.println(total);
        }

        catch(EOFException e){
            finished = true;
        }
        catch(IOException e){
            e.printStackTrace();
        }
        try {
            br.close();
            inFile.setMigrated(true);
            pw.close();
            outFile.setMigrated(true);
        } catch (IOException e) {
            e.printStackTrace();
        }
        suspending = false;

    }