Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 8

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\
Level 8

Re: WriteFile and AppendFile

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

0 Kudos