Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
greubel
Visitor

WriteFile and AppendFile

I realize it's a little late in the game but the BRS functions WriteFile() and AppendFile() leave a little to be desired.
WriteFile() replaces the WHOLE file but it does allow for partial buffer transfers.
AppendFile() does move the data to the end of the file BUT it transfers the entire buffer. There is no partial buffer transfer.

You should be able to do this:
buf.WriteFile( "tmp:/somefile" , 0, 100 )
buf.WriteFile( "tmp:/somefile" , 0, 100 ) <-------- need to append like a normal write
buf.WriteFile( "tmp:/somefile" , 0, 100 )
and end up with a file of 300 characters.

Or this:
buf.WriteFile( "tmp:/somefile" , 0, 100 )
buf.AppendFile( "tmp:/somefile" , 0, 100 ) <-------- need to allow start and length
buf.AppendFile( "tmp:/somefile" , 0, 100 )

Without either of these capabilities, it requires that you create a new "roByteArray" and copy
over the data a character at a time from the original buffer before doing an append. This produces a lot of overhead.
0 Kudos
1 REPLY 1
RokuMarkn
Visitor

Re: WriteFile and AppendFile

Good point. I have filed an enhancement request for this.

--Mark
0 Kudos