문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top