public void startBodyPart() throws MimeException { expect(Multipart.class); BodyPart bodyPart = new BodyPart(); ((Multipart) stack.peek()).addBodyPart(bodyPart); stack.push(bodyPart); }
public BodyPart build() { BodyPart bodyPart = new BodyPart(); HeaderImpl header = new HeaderImpl(); bodyPart.setHeader(header); for (Field field : getFields()) { header.addField(field); } bodyPart.setBody(getBody()); return bodyPart; }
/** * Creates a new <code>BodyPart</code> from the specified * <code>Entity</code>. The <code>BodyPart</code> instance is initialized * with copies of header and body of the specified <code>Entity</code>. * The parent entity of the new body part is <code>null</code>. * * @param other * body part to copy. * @throws UnsupportedOperationException * if <code>other</code> contains a {@link SingleBody} that * does not support the {@link SingleBody#copy() copy()} * operation. * @throws IllegalArgumentException * if <code>other</code> contains a <code>Body</code> that * is neither a {@link Message}, {@link Multipart} or * {@link SingleBody}. */ public BodyPart copy(Entity other) { BodyPart copy = new BodyPart(); if (other.getHeader() != null) { copy.setHeader(copy(other.getHeader())); } if (other.getBody() != null) { copy.setBody(copy(other.getBody())); } return copy; }
final List<Entity> otherParts = other.getBodyParts(); for (Entity otherPart: otherParts) { BodyPart bodyPart = new BodyPart(); Header otherHeader = otherPart.getHeader(); if (otherHeader != null) {