Hi to All
I have a List of ExternalFile objects. The list is obtained on an external sd card, with:
I want to save the objects in the quicker way. I had the idea to use TextWriter.WriteList. Therefore :
At this point I get the attached file, which has 3 lines per each ExternalFile Object. Somewhere, in this forum, I have read that WriteList writes one line per Object. This seems not true, in my case.
The Notepad++ image shows what I see. The file is attached. Now, ReadList reads 3 lines. Must I reconstruct each ExternalFile with the 3 strings, or I must use another method? (Or am I missing something..) Thanks in advance.
I have a List of ExternalFile objects. The list is obtained on an external sd card, with:
B4X:
Dim FF as List
FF=Storage.ListFiles("Storage. ..." ) ' variables are correctly declared. This line is just to fix ideas
I want to save the objects in the quicker way. I had the idea to use TextWriter.WriteList. Therefore :
B4X:
Sub WriteFilesWrk(FF As List)
Dim Ist As OutputStream
Dim EE As ExternalFile
Dim Txw As TextWriter
EE=Storage.CreateNewFile(Storage.Root,NomeLav & ".wrk")
Ist=Storage.OpenOutputStream(EE)
Txw.Initialize(Ist)
Txw.WriteList(FF)
Txw.Close
Ist.Close
End Sub
private Sub ReadFilesWrk
Dim EE As ExternalFile
EE=Storage.FindFile(Storage.Root,NomeLav &".wrk")
If EE.IsInitialized Then
Dim Ist As InputStream
Dim Txr As TextReader
Dim LL As List
Ist=Storage.OpenInputStream(EE)
Txr.Initialize(Ist)
LL=Txr.ReadList
Txr.Close
Ist.Close
End If
End Sub
At this point I get the attached file, which has 3 lines per each ExternalFile Object. Somewhere, in this forum, I have read that WriteList writes one line per Object. This seems not true, in my case.
The Notepad++ image shows what I see. The file is attached. Now, ReadList reads 3 lines. Must I reconstruct each ExternalFile with the 3 strings, or I must use another method? (Or am I missing something..) Thanks in advance.