-
Buffered reader
Hey, I need some help with some code part, my task in our project is to make a program that can read a LOC-file for a GPS, and this is my code so far, I've made a Jfilechooser so far that can take only LOC-files but I don't know how to create a buffered reader that can read the LOC-file and translate it in for the GPS, can anyone help me with this? this is my code so far ..
import javax.swing.*;
public class ReadGeo {
private static String fileChooser(){
JFileChooser jfc = new JFileChooser();
jfc.setAcceptAllFileFilterUsed(false);
jfc.setDialogTitle("Filechooser");
jfc.setFileFilter(new javax.swing.filechooser.FileNameExtensionFilter("L OC files", "loc"));
int resultat = jfc.showOpenDialog(null);
if (resultat != JFileChooser.APPROVE_OPTION){
JOptionPane.showMessageDialog(null, "You didnt pick a file");
System.exit(0);
}
String filnamn = jfc.getSelectedFile().getAbsolutePath();
return filnamn;
}
public static void main(String[] args){
String jfgf = fileChooser();
System.out.println(jfgf);
}
}
-
How does your loc file looks like. Please give us an example. Probably its an xml file/format then you could use an XML Parser(e.g. JDOM) instead of using BufferedReader an manually parsing the file. Generally, I would recommend to use the Scanner class instead of the BR for manually parse
And what do you mean with translate? :confused: