B4J Question Open json file inside .b4xlib

Sergio Haurat

Active Member
Licensed User
Longtime User
I have this library that needs an additional file in json format only in B4J. Is there a way to extract the file from the library and copy it to the Files folder if the version of the file in the library is newer?


Thanks for your help
 
Solution
. Is there a way to extract the file from the library and copy it to the Files folder if the version of the file in the library is newer?
You can extract the file from the library. but you only copy it to other folders as aeric said
B4X:
    Dim r As Reflector
    r.Target = Me
    r.Target = r.RunMethod("getClass")
    Dim In As InputStream = r.RunMethod2("getResourceAsStream", "/Files/" &  "os.lang.ping.json", "java.lang.String")
    Dim out As OutputStream
    out=File.OpenOutput(File.DirApp, "os.json", False)
    File.Copy2(In, out)
    In.Close
    out.Close

teddybear

Well-Known Member
Licensed User
. Is there a way to extract the file from the library and copy it to the Files folder if the version of the file in the library is newer?
You can extract the file from the library. but you only copy it to other folders as aeric said
B4X:
    Dim r As Reflector
    r.Target = Me
    r.Target = r.RunMethod("getClass")
    Dim In As InputStream = r.RunMethod2("getResourceAsStream", "/Files/" &  "os.lang.ping.json", "java.lang.String")
    Dim out As OutputStream
    out=File.OpenOutput(File.DirApp, "os.json", False)
    File.Copy2(In, out)
    In.Close
    out.Close
 
Upvote 0
Solution
Top