Java BufferedReader check next lines of a loop before looping

I'm parsing a .cvs file. For each line of the cvs, I create an object with the parsed values, and put them into a set.

Before putting the object in the map and looping to the next, I need to check if the next cvs's line is the same object as the actual, but with a particular property value different.

For that, I need check the next lines of the buffer, but keep the loop's buffer in the same position.

For example:

BufferedReader input  = new BufferedReader(new InputStreamReader(new FileInputStream(file),"ISO-8859-1"));
String line = null;

while ((line = input.readLine()) != null) {
    do something

    while ((nextline = input.readLine()) != null) { //now I have to check the next lines
       //I do something with the next lines. and then break.
    }
    do something else and continue the first loop.
}
7
задан André Perazzi 8 February 2012 в 17:21
поделиться