Without closing and re-opening the file stream, is it possible to just start back over at the beginning of the BufferReader? The problem with my code is it isn't pulling all of the results because when it goes through one pass, it's reading the entire file, and when I increment i, it doesn't do anything because the BufferReader is at the end already. At least that's what I am thinking.
try
{
File temp = new File ("./" + filename + ".lst");
File txtFile = new File (libraryList);
FileInputStream fstream = new FileInputStream (txtFile);
DataInputStream in = new DataInputStream (fstream);
BufferedReader br = new BufferedReader (new InputStreamReader (in));
ArrayList al = new ArrayList ();
String[] line;
if (!temp.exists ())
{
try
{
FileWriter fileOut = new FileWriter (temp, false);
BufferedWriter out = new BufferedWriter (fileOut);
for (int i = 0; i < currentPlaylistItems.size (); i++)
{
String[] song = currentPlaylistItems.get (i).toString ().replaceAll (" \\(.*$", "").split (" - ");
while(br.readLine () != null)
{
line = br.readLine ().split ("\t");
if (song[0].equals (line[1]) && song[1].equals (line[2]))
{
System.out.println ("The path to " + line[1] + " - " + line[2] + " is " + line[3]);
}
// need something right here to reset the reader to the very beginning
}
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
catch (Exception e)
{
System.out.println (e);
}