I have to write byte arrays in a file. I can't do it in one time so I can't put my arrays in a container. Also the size of my arrays is variable. Secondly, the file is very huge, so I have to split it, in order to read it array by array.
How can I do that ? I tried to write line by line my byte arrays but I haven't been able. How can I put a separator between my arrays and after split it over this separator ?
EDIT :
I tried this :
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(bos);
out.writeObject(byteArray);
But, I execute this code several times, so the ObjectOutputStream adds each time a new header which corrupt the file.
I also try :
out.write(byteArray);
but I couldn't separate my arrays. So I tried to append a '\n', which didn't work. After I was looking for library like FileUtils in order to write byte[] line by line but I didn't find.