Results 1 to 2 of 2

Thread: Buffered reader

  1. #1
    franckboy is offline Member
    Join Date
    Feb 2011
    Posts
    1
    Rep Power
    0

    Default 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);
    }

    }

  2. #2
    eRaaaa is offline Senior Member
    Join Date
    Oct 2010
    Location
    Germany
    Posts
    787
    Rep Power
    11

    Default

    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:

Similar Threads

  1. Buffered Reader and scanners
    By nevermiind in forum New To Java
    Replies: 8
    Last Post: 05-04-2010, 07:22 PM
  2. Buffered Reader
    By ilovepolluting in forum New To Java
    Replies: 2
    Last Post: 02-04-2010, 10:16 AM
  3. Buffered Reader problem
    By pradeep.theonlyone in forum New To Java
    Replies: 3
    Last Post: 07-31-2009, 12:37 PM
  4. Buffered Reader Exception
    By hitmen in forum New To Java
    Replies: 6
    Last Post: 01-07-2009, 12:14 PM
  5. FileReader / Buffered Reader
    By sepaht in forum New To Java
    Replies: 9
    Last Post: 07-10-2008, 09:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •