Frage

I am developing a Java application that reads and writes byte arrays (of seemingly random bytes) in a file.

I would like to know what method I can use to separate these byte arrays, because if I encode them in UTF-8, I might run into a newline character by accident right?

So then the bufferedReader.nextLine() might think it's the end of a byte[]?

Downvoter, care to explain?

War es hilfreich?

Lösung

If you're writing and reading bytes you probably just want to use a DataOutputStream and DataInputStream

The way you separate the different byte arrays is by knowing the number of bytes and the order they appear in the file.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top