B4A Code Snippet [B4X] Bytes To File - Erel    May 24, 2020   (19 reactions)   tags: Image, Share Images, Bytes, B4X, B4X Bytes To File This code is no longer needed. Use File.WriteBytes / ReadBytes. Write an array of bytes to a file and read a file into an array of bytes. Sub BytesToFile (Dir As String, FileName As String, Data() As Byte) Dim out As OutputStream = File.OpenOutput(Dir, FileName, False) out.WriteBytes(Data, 0, Data.Length) out.Close End Sub Sub FileToBytes (Dir As String, FileName As String) As Byte() Return Bit.InputStreamToBytes(File.OpenInput(Dir, FileName)) End Sub Note that you can convert... B4A Tutorial [B4X] OkHttpUtils2 with Wait For - Erel    Dec 25, 2025   (59 reactions)   tags: image, wait, Download, Http MySql, Wait For, ws = j.GetBitmap End If j.Release End Sub Example of saving the downloaded file: Sub DownloadAndSaveFile (Link As String) Dim j As HttpJob j.Initialize("", Me) j.Download(Link) Wait For (j) JobDone(j As HttpJob) If j.Success Then Dim out As OutputStream = File.OpenOutput(File.DirInternal, "filename.dat", False) File.Copy2(j.GetInputStream, out... B4A Question File.OpenOutput 'too many parameters' - khaleel (first post)    Apr 9, 2017 Whops.
I missed that it's a method.
thanks anyway !!!... B4A Question Solved - Can multiple File.OpenOutput yield 1 file? - DonManfred (first post)    Sep 3, 2015 However all the images get written to SD card.
If you do it right it just will work :-)... B4i Question File.OpenOutput return 'null' - nicieri (first post)    Feb 3, 2016 to the same variable. The previously object is removed.
2. File.OpenOutput opens an output stream. Output streams are used to write data to a file.
Correct code:
Dim b() As Byte = Bit... B4A Library Printing and Pdf creation - Erel    May 18, 2020   (55 reactions)   tags: print, pdf, pdf print, Printing and Pdf As OutputStream = File.OpenOutput(File.DirInternal, "1.pdf", False) pdf.WriteToStream(out) out.Close....DrawText. 4. Call FinishPage. 5. Repeat the above 3 steps for each page. 6. Save the document to a file...="${WebViewAssetFile("smiley.png")}"/>"$) End Sub Sub WebViewAssetFile (FileName....b4a.objects.streams.File") If jo.GetField("virtualAssetsFolder") = Null Then Return "file:///android_asset/" & FileName.ToLowerCase Else Return "file://"... B4J Code Snippet Redirect the output to a file - Erel    Mar 28, 2016   (19 reactions)   tags: Redirect, File, Log, B4J Snippet Name: RedirectOutput Description: This sub will redirect the program output to a file. Sub RedirectOutput (Dir As String, FileName As String) #if RELEASE Dim out As OutputStream = File.OpenOutput(Dir, FileName, False) 'Set to True to append the logs Dim ps As JavaObject ps...(File.DirApp, "logs.txt") If this app will be installed with an installer then you should not use File.DirApp as it will be read-only.... B4A Code Snippet [B4X] DownloadAndSave - Erel    Feb 12, 2019   (32 reactions)   tags: Code snippet, Download And Save, B4X DownloadAndSave File Then Dim out As OutputStream = File.OpenOutput(Dir, FileName, False) File.Copy2(j...This is a slightly modified sub based on the code from: OkHttpUtils2 with Wait For Call it when you want to download a file and save it. You can wait for it to complete if needed. Sub DownloadAndSave (Url As String, Dir As String, FileName As String) As ResumableSub Dim j As HttpJob j... For (DownloadAndSave(URL, File.DirInternal, "map_large.jpg")) Complete (Success As Boolean... Games [XUI2D] Large background class + example - Erel    Jun 14, 2021   (11 reactions) + 1), ColumnWidth, RowHeight) Dim out As OutputStream = File.OpenOutput("C... Files folder. The code itself is very simple: Background.Initialize(Me, "map", "png", TotalWidth, TotalHeight, 7, 14) "map" - the files prefix "png" - the files... B4A Question Problem saving a file with OpenOutput - thedesolatesoul (first post)    Feb 9, 2013 do log(filename) before, to see what is in it... Page: 1   2   3   4   5   6   7   |