use of org.apache.james.mime4j.stream.EntityState in project webservices-axiom by apache.
the class PartImpl method discard.
@Override
public void discard() {
try {
switch(state) {
case STATE_UNREAD:
EntityState parserState;
do {
parserState = parser.next();
} while (parserState != EntityState.T_START_BODYPART && parserState != EntityState.T_END_MULTIPART);
state = STATE_DISCARDED;
break;
case STATE_BUFFERED:
content.release();
}
} catch (MimeException ex) {
throw new MIMEException(ex);
} catch (IOException ex) {
throw new MIMEException(ex);
}
}
use of org.apache.james.mime4j.stream.EntityState in project webservices-axiom by apache.
the class PartImpl method moveToNextPart.
private void moveToNextPart() {
try {
checkParserState(parser.next(), EntityState.T_END_BODYPART);
EntityState state = parser.next();
if (state == EntityState.T_EPILOGUE) {
while (parser.next() != EntityState.T_END_MULTIPART) {
// Just loop
}
} else if (state != EntityState.T_START_BODYPART && state != EntityState.T_END_MULTIPART) {
throw new IllegalStateException("Internal error: unexpected parser state " + state);
}
} catch (IOException ex) {
throw new MIMEException(ex);
} catch (MimeException ex) {
throw new MIMEException(ex);
}
parser = null;
}
Aggregations