So the first four bytes of my ByteArrayOutputStream contain the length of a header in my stream. I need to remove that header from the stream and go on with my business.
ByteArrayOutputStream oStream = new ByteArrayOutputStream();
/* populate ByteArrayOutputStream */
//grab first int
int headerLength = oStream.toByteArray()[4];
//remove headerLength
String newString = oStream.toString().substring(jsonLength, oStream.size());
oStream.write(newString.getBytes());
I don't think this is the proper way to go about this though, does anyone have any suggestions?