I am trying to read a dat file and store column names.
The first line in the file is separated by spaces.
The following code is unable to split the column names from the line
FileInputStream fis=new FileInputStream("file.dat");
BufferedReader br=new BufferedReader(new InputStreamReader(fis));
String k=line.split(" ");
It's possible that the fields are separated by whitespace other than the simple
" " space. You can try splitting by any kind of whitespace with:
If this doesn't work either, the data is not separated by whitespace. Try using a hex editor/viewer to see what the separator character is.