Me again Ernest and sorry for being a pest but I am following your suggested approach in the development the Unix time conversion utility. I have gotten to a point where I am stuck again. I have gotten to step 3 of your approach and can't seem to figure out how to us the String.split()method to break the lines into tokens. The lines I am trying to break into tokens look like:
JPM \t1080593081\t518:3:417\t496:30:147\t502:9:15\t532:9:1\t602:27:XDSVP_514\t546:27
iagnostics\t503:27:XDJ_559714\t518:20:0\t496:20:0\t
JPM \t1080593512\t518:3:418\
my code so far looks like this after reading the Javadoc API :
code
/UnixTime
import java.io.*;
import java.util.*;
import java.io.BufferedReader;
import java.io.FileReader;
public class UnixTime {
public static void main(String[] args) throws IOException {
File inputFile = new File("Unix_in.txt");
File outputFile = new File("Unix_out.txt");
FileReader in = new FileReader(inputFile);
BufferedReader br = new BufferedReader(inputFile);
try {
BufferedReader in = new BufferedReader(new FileReader("Unix_.txt")
String str;
while ((str = in.readLine()) != null) {
process(str);
}
in.close();
} catch (IOException e) {
}
String[] result = "What goes here??".split("\\s");
for (int x=0; x<result.length; x++)
System.out.println(result[x]);
PrintWriter out = new PrintWriter(outputFile);
System.out.println("The time is: + outputFile);
}
}
code/
Do I need to specify the value in each line to break it into tokens and how will I declare and define what the process method will do. Any help will be appreciated, thanks.