boolean stopped = false;
try {
this.parser.execute(this.settings, buf);
} catch (HTTPException e) {
throw new RaiseException(runtime, eParserError, e.getMessage(), true);
} catch (StopException e) {
stopped = true;
}
if (parser.getUpgrade()) {
byte[] upData = fetchBytes(buf, buf.position(), buf.limit() - buf.position());
((RubyString)upgradeData).concat(runtime.newString(new String(upData)));
} else if (buf.hasRemaining()) {
if (!stopped)
throw new RaiseException(runtime, eParserError, "Could not parse data entirely", true);
}
return RubyNumeric.int2fix(runtime, buf.position());
}