When downloading a CSV file using HTTPJOB Is there a way to save a CSV file directly to a string instead of to a file?
B4X:
Sub DownloadAndSave (Url As String, Dir As String, FileName As String) As ResumableSub
Dim j As HttpJob
j.Initialize("", Me)
j.Download(Url)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim out As OutputStream = File.OpenOutput(Dir, FileName, False)
File.Copy2(j.GetInputStream, out)
out.Close
End If
j.Release
Return j.Success
End Sub
How do I convert the j.GetInputStream to just a normal string?
If j.Success Then
'work with result
Dim csv_buffer As String = j.getstring
'Log(j.GetString)
table_test = csv_parser.Parse(csv_buffer,";",False)
Dim i As Int
For i=1 To table_test.Size
Dim row() As String = table_test.Get(table_test.Size-i)
'Log(table_test.Size)
Log(row(1))
Log(row(2))
Log(row(3))
Log(row(4))
Log(row(5))
Next