// It's ok for additional CRLFs to preceed first boundary.
newIOBuffer.writeBytes("\r\n--".getBytes());
newIOBuffer.writeBytes(rangeBoundary.getBytes());
if (rangeContentType != null) {
newIOBuffer.writeBytes("\r\n".getBytes());
newIOBuffer.writeBytes("Content-Type: ".getBytes());
newIOBuffer.writeBytes(rangeContentType.getBytes());
}
newIOBuffer.writeBytes("\r\n".getBytes());
newIOBuffer.writeBytes("Content-Range: ".getBytes());
newIOBuffer.writeBytes(("bytes " + p.getStart() + "-" + p.getEnd()