File.GetText x File.ReadString , What's difference ?

fabioferreiracs

Member
Licensed User
Longtime User
what is the difference between:

B4X:
File.GetText

File.ReadString

my code :

B4X:
Dim parser As JSONParser

   Dim ListaMatriz As List
   ListaMatriz.Initialize
   ListaMatriz.Clear
      
   Dim pageTwitter As String
   pageTwitter = File.GetText(File.DirInternal, "pageTwitter.json")

   parser.Initialize(File.GetText(File.DirInternal, "pageTwitter.json"))
         
   Log("pageTwitter:" & parser)

ListaMatriz = parser.NextArray

this code always this ok. when use :

B4X:
Dim parser As JSONParser

   Dim ListaMatriz As List
   ListaMatriz.Initialize
   ListaMatriz.Clear
      
   parser.Initialize(File.ReadString(File.DirInternal, "pageTwitter.json"))
         
   Log("pageTwitter:" & parser)

ListaMatriz = parser.NextArray

sometimes appears an error in reading the file, Undetermined character at ...

the Json file is a big file.
 

mc73

Well-Known Member
Licensed User
Longtime User
There is no difference between the two methods.
Having a look at the documentation, I noticed that getText waits for utf-8. But I got confused, since I thought both methods would treat strings as utf-8.
 
Upvote 0
Top