I am trying a create a .dat file that is split into 5 columns each with the heading, "timestamp", "deviceId", "testId", "Availability" and "Latency". This file is going to be pointed to a database where there are tests being ran at the moment.
The idea is that the data from these tests will be collected and stored into this file that I have just created.
I have been told to use and work with RandomAccessFile.
Only problem is I have no idea how to write a file through Java. I have made somewhat of an attempt but it is by no means much at all;
public long timestamp;
public int deviceId;
public int testId;
public byte availability;
public int latency;
public static void main (String [] args) throws FileNotFoundException
{
String fileName = "hopeToJaysusThisWorks.dat";
RandomAccessFile file = new RandomAccessFile(fileName, "rw");
}
As you can see, its not much at all!
I was told not to worry about getting into the technical side of things yet i.e the collection of data. At the moment all I need is the layout of each column and its 5 headings.
Can anyone help me or give me some advice on where to go from here, it would be much appreciated.