Sunday 15 February 2015

java - How to read a text file more than once -



java - How to read a text file more than once -

i may have found solution: inputstream not reset beginning how can implement code? need read text file more 1 time using:

while (true){ final string checkusername = brusername.readline(); if (checkusername == null) { break; } if (checkusername.equals(usernameinput)) { correctusername = true; } }

the readers , writers:

filewriter fwusername = new filewriter("username.txt", true); filereader frusername = new filereader("username.txt");// reads created file username.txt printwriter pwusername = new printwriter(fwusername, true); bufferedreader brusername = new bufferedreader(frusername);

i can't while loop more once. no error given while loop skipped. 1. how can repeat loop? 2. if can't repeat loop, how can store of values can check that? 3. link may have solution don't know how answer: how reopen file input stream. beginner don't have much knowledge. code using: dropbox.com/s/du1u01f27t0ok2o/codehelp.txt?dl=0

frusername = new filereader("username.txt"); brusername = new bufferedreader(frusername); while (true){ final string checkusername = brusername.readline(); if (checkusername == null) {break;} if (checkusername.equals(usernameinput)) {correctusername = true;} }

java loops text

No comments:

Post a Comment