Search in sources :

Example 1 with EntityState

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);
    }
}
Also used : MimeException(org.apache.james.mime4j.MimeException) EntityState(org.apache.james.mime4j.stream.EntityState) IOException(java.io.IOException)

Example 2 with EntityState

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;
}
Also used : MimeException(org.apache.james.mime4j.MimeException) EntityState(org.apache.james.mime4j.stream.EntityState) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)2 MimeException (org.apache.james.mime4j.MimeException)2 EntityState (org.apache.james.mime4j.stream.EntityState)2