in my program I receive a bytearray. The first part is actually a string and the second a picture converted into a byte array.
Like this:
<STX>1<US>length of picture<ETX> here are the bytes...
At the moment I have this to split the part before and after the ETX
string incomingMessage = incomingBytes.toString();
String messagePart = incomingMessage.substring(0, firstETX);
String dataPart = incomingMessage.substring(firstETX, incomingMessage.length());
Afterwards I use
dataPart.getBytes();
To convert it back into a byte array.
But I think converting the bytes containing the image causes some problems, because my program won't convert the bytes to an image.
So how do I get the bytes after the ETX without converting it to a string? Or how do I keep the original bytes so I can use them?
Thx