reading the value of text file when it gets updated
<p>I am trying to read the contents of a text file and write to another file. The thing is I want to read the file every 1sec. Here is what I have tried.</p>

<pre><code>void setData() {
      System.out.println("inside setdata");
      String line = null;
      String file = "E:/sss.txt";
      FileInputStream fis = null;
      String text = null;
      try{
             ....

     while(true) {

       byte bt[] = new byte[(int) file.length()];

        fis.read(bt);
        text = new String(bt);
        System.out.println( text);
        fis.close();  
        line = text + line;
        while(text != null) {
        Thread.sleep(2000);
        System.out.println(line);
        }     
      }
     }catch (Exception e){

            }

    }
</code></pre>

<p>Where am I wrong here?</p>

<p>What Iget is</p>

<pre><code>inside setdata
inside try
http://www.
http://www.null
http://www.null
http://www.null
</code></pre>

<p>going on and on 
  Thanks in advance</p>
