tags:

views:

66

answers:

2
+1  A: 

There might be lots of reasons. if you send your code, it's easier to say. But you could check: 1. you have closed your Stream when writing to the file (It is recommended that you do it in a finally block) like this:

try{
....
write the data to the file with some outputStream
}finally{
      outputStream.close();
}

2. If you want to read the data before closing the stream, make sure your output-stream does not buffer the output. if it doues, before reading the data, flush the output to the file:

outputStream.flush();

3. Check for any exception that might be caught, but not logged, some code like this:

try{
    ...
}catch(IOException ex){
    // here must log the exception.
}

}

Majid
I tried as you having the outputstream.close() in the finally block but it did not help. Let me modify my question to contain the snippet.
Ramp
Thanks for your responses. I figured out what the issue was, I should be flushing and closing the BufferedWriter instead of OutputStreamWriter. Thanks again
Ramp
A: 

Thanks for your responses. I figured out what the issue was, I should be flushing and closing the BufferedWriter instead of OutputStreamWriter. Thanks again

Ramp