Android Question textwriter, outputstream and flushing

leitor79

Active Member
Licensed User
Longtime User
Hi,

I'm having an issue with a file a write and rewrite over and over (sometimes it arrives with the previous data), and I'm trying to figuring out the case.

One thing I have doubt about is regarding the closing. I don't know if I'm using the correct methods and in the correct order to close the file. Out is the OutputStream, tw is the TextWriter:

Code: Copy
.
.
.
tw.Initialize(Out)
tw.WriteLine(S)
tw.Flush
tw.Close
Out.close

I had the Out.Flush sentence also, but I've removed it since I was getting an exception.

Any ideas?

Regards!
 
Hi Erel, thanks for your answer!

Actually the file can exist or not, it depends on another process.

This is how I'm opening it:

Code: Copy
Out = File.OpenOutput(File.DirRootExternal, "sr", True)
tw.Initialize(Out)
tw.WriteLine(S)

The reason for asking is because I'm not familiar with the Java flush... I know what it is but I don't know when should I use it..


thank you very much!
 
Upvote 0
Hi Erel

How Do i disable the Textwriter1.flush from sending a newline <LF> character When i Flush?
This is an embedded project and i really need to Disable this

Thank you kindly
Best Regards
jody
 
Upvote 0

Similar Threads

Replies
5
Views
3K
  • Article Article
Android Code Snippet aSyncStream and flush
Replies
0
Views
4K
Replies
36
Views
137K
  • Article Article
Android Code Snippet [B4X] Bytes To File
Replies
28
Views
69K
Back
Top