How to return to line in file java -



How to return to line in file java -

i need add together items combobox externel file (java).my problem read first line , code:

file names_file = new file("data" + file.separator + "c://users//hatem//desktop//fichadr.txt"); fileinputstream fis = null; bufferedinputstream bis = null; datainputstream dis = null; string str_data = ""; //for storing input file. seek { fis = new fileinputstream("c://users//hatem//desktop//fichadr.txt"); // here bufferedinputstream added fast reading. bis = new bufferedinputstream(fis); dis = new datainputstream(bis); str_data = dis.readline(); //reading line file. stringtokenizer st = new stringtokenizer(str_data); //tokenizing line. //the below line adds 1 item. objective adding items. //*** requesting help here *** jcombobox1.additem(st.nexttoken("|")); //*** requesting help here *** // disposing , closing resources after using them. fis.close(); bis.close(); dis.close(); } grab (filenotfoundexception e) { system.err.println("error: file not found!"); joptionpane.showmessagedialog(null, "error: file not found!", "error message", joptionpane.error_message); } grab (ioexception e) { system.err.println("error: unable read file!"); joptionpane.showmessagedialog(null, "error: unable read file!", "error message", joptionpane.error_message); }

i'm debutant in programming can help me resolve problem. give thanks you.

you should utilize loop like:

while((str_data = dis.readline()) != null){ parse line here }

additional parentheses increment priority of instruction.

java

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -