Java -  printing lines from buffered reader 
<p>I'm writing an <code>InputStream</code> that supplies lines from a file in constant intervals. I used <code>BufferedReader</code> before, but ran into buffering issues with it (wasn't getting anything until the entire file was read), and speed isn't an issue anyways (the intervals are something like every second, or every half second - along those lines). Is there a class with a <code>readLine</code> method like in <code>BufferedReader</code>, except unbuffered?</p>

<p>(Edit: I just checked - my class seems to work, apparently the problem was with the output)</p>

<p>Here's the code where I used the stream (<code>OnlineDataSimulator</code>). I already checked, the stream does exactly what I want, so apparently I'm doing something wrong with the output. (The actual problem is, I want output to occur every X milliseconds - X being the second parameter to <code>OnlineDataSimulator</code>. What happens when I run this code is, that I first get an X*lines wait and then the entire output at once instead.)</p>

<pre><code>        System.out.println("Testing:");
        PrintStream fout = new PrintStream(new FileOutputStream("testfile"));
        for(int i=0; i&lt;20; ++i) {
            fout.println(i);
        }
        fout.close();
        BufferedReader fin = new BufferedReader(new InputStreamReader(
                new OnlineDataSimulator("testfile",250)));
        String line;
        while((line=fin.readLine())!= null){
            System.out.println(line);
            System.out.flush();
        }
        fin.close();
        (new File("testfile")).delete();
</code></pre>
