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:

B4X:
.
.
.
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!
 

leitor79

Active Member
Licensed User
Longtime User
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:

B4X:
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

Jody

New Member
Licensed User
Longtime User
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
Top