Reputation: 5371
I have a stream of bytes (given by a BufferedInputStream) which represents a sequence of UTF-8 strings. The protocol is a little crappy becauses it uses 0xFF between commands, which implies that the whole stream is not a valid UTF-8 string, only the parts between the 0xFF are.
How can I extract those UTF-8 strings.
I don’t think BufferedReader would work, because the 0xFF will mess up everything and I have found no byte array to UTF-8 string conversion function.
Upvotes: 2
Views: 11353
Reputation: 13222
So would be new String(bytes, "UTF-8");
You would need to filter the Stream beforehand though.
Upvotes: 2