I have currently got data in a text file structured such as,
0.01 0.01 191650 5 | ae
0.01 0.01 146570 8 | am
0.04 0.04 994907 36 | br
0.23 0.21 5282499 212 | at
i would like to amend the script below to bring each individual column into its own List within a text area,
(So at a later date to sort it via columns) i.e.
-------------------------
|0.01|0.01|191650|5|
|0.01|0.01|146570|8|
-------------------------
Any suggestions?
Thanks
0.01 0.01 191650 5 | ae
0.01 0.01 146570 8 | am
0.04 0.04 994907 36 | br
0.23 0.21 5282499 212 | at
i would like to amend the script below to bring each individual column into its own List within a text area,
(So at a later date to sort it via columns) i.e.
-------------------------
|0.01|0.01|191650|5|
|0.01|0.01|146570|8|
-------------------------
Code:
import java.net.*;
import java.io.*;
import java.util.*;
class Files
{
public static void main(String args[])
{
try
{
DataInputStream inputFile = new DataInputStream(new FileInputStream("C:\\Clients.txt"));
String data;
float Reqs;
float Bytes;
int BytesSent;
int Requests;
data = inputFile.readLine();
while (data != null)
{
StringTokenizer st = new StringTokenizer (data);
Reqs = Float.parseFloat(st.nextToken());
Bytes = Float.parseFloat(st.nextToken());
BytesSent = Integer.parseInt(st.nextToken());
Requests = Integer.parseInt(st.nextToken());
System.out.println(Reqs + "\t" + Bytes + "\t" + BytesSent + "\t" + Requests);
data = inputFile.readLine();
}
inputFile.close();
}
catch(IOException e)
{
System.out.println("Error : " + e);
}
}
}
Thanks