Android Question Using correctly File.WriteList

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi.
My problem is to write on disk various Lists, in sequence, on same file. The saving sequence is:
B4X:
    File.Delete(InternalWorkDir,FileUndo)
    File.WriteList(InternalWorkDir,FileUndo,Layers)
    File.WriteMap(InternalWorkDir,FileUndo,colorMap)
    b=rvs.ConvertObjectToBytes(layerMap.Size) ' just an integer
    File.WriteBytes(InternalWorkDir,FileUndo,b)
The list, the map and the integer are saved with no error. But when I try to load the data with:
B4X:
    Layers.Initialize ' not sure if necessary
    Layers=File.ReadList(InternalWorkDir,FileUndo)
     colorMap=File.ReadMap(InternalWorkDir,FileUndo)
    b=File.ReadBytes(InternalWorkDir,FileUndo)
    size=rvs.ConvertBytesToObject(b)
I don't find the same data, actually I find nothing. If I just save and reload the first list, it works. It seems that wrtiting destroys previous data. So I am missing something, of course. Using TextWriter is out of question, because, besides the above list and map, I have much more data to save, in other maps and atrays, and the process will be intolerably slow. I successfully did the process with RandomAccesFile, but it is too slow on huge data. Something working faster than RandomAccesFile is necessary.
Thanks for any hint
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…