B4J Question How can I manage and create a 2GB+ array using SubArray2 function (B4XBytesBuilder class)?

prbmjr

Active Member
Licensed User
Hi Everyone!

My app should be a cross platform app, and must be prepared to encrypt files more than 2 GB, like videos etc... For that, I'm using the class B4XBytesBuilder and the function SubArray2 to implement the encryption, but I have a problem, this function only use integers instead of long types, makes the thing more complicated because I could only manage arrays below 2Gb aprox. and I need to cover the possibility to handle + 2gb arrays , How can I solve this situation?

Thanks in advance!

br,

Paulo Bueno
 

KMatle

Expert
Licensed User
Longtime User
One way is to encrypt chunks of the data (e.g. 1 MB). Check the RandomAccess library. Here you can read/write x bytes from a file and encrypt/decrypt it (e.g. via Encryption lib which is compatible with all plattforms, even php, .net, etc). Problem here is that en-/decrypting chunks may take a while. Benefit: You can do it even on devices which have limited ressources like phones/tablets.
 
Upvote 0

prbmjr

Active Member
Licensed User
One way is to encrypt chunks of the data (e.g. 1 MB). Check the RandomAccess library. Here you can read/write x bytes from a file and encrypt/decrypt it (e.g. via Encryption lib which is compatible with all plattforms, even php, .net, etc). Problem here is that en-/decrypting chunks may take a while. Benefit: You can do it even on devices which have limited ressources like phones/tablets.

Hi KMatle,

Thank you for your comments!

I have to try, may be one option is use this solution only for the 2GB+ arrays...
 
Upvote 0
Top