vendredi 31 juillet 2015

Appending to an array vs writing to file

I'm writing a program which takes in a byte array of potentially millions of bytes, reads each one from a BinaryArrayInputStream, and if the byte is not "printable" (ascii 32-126), that byte is encoded in a certain way and written to a BinaryArrayOutputStream instance; if the byte is "printable" it is directly written to that same BinaryArrayOutputStream instance. So from a broader view I am taking in a byte array, and getting back a similar byte array except certain characters have been encoded.

My question is: would it be faster to write my data out to a file or to continuously be writing to this OutputStream?

Aucun commentaire:

Enregistrer un commentaire