while (contentLength > 0) {
try {
int len = stream.read(bodybytes, pos, contentLength);
if (len < 0) {
throw new XProcException("Read returned -1?");
}
pos += len;
contentLength -= len;
} catch (IOException ioe) {
throw new XProcException(ioe);
}
}
// The separator has to be at the start of a line...
int peek = peekByte();
if (peek == '\r') {
nextByte();
peek = peekByte();
}
if (peek == '\n') {
nextByte();
}
String line = getLine();
if (!separator.equals(line) && !lastsep.equals(line)) {
throw new XProcException("MIME multipart missing separator?");
}
return new ByteArrayInputStream(bodybytes);
}