Package org.apache.axiom.mime
Class MultipartBody
java.lang.Object
org.apache.axiom.mime.MultipartBody
A MIME multipart message read from a stream. This class exposes an API that represents the
message as a sequence of
Part instances. It implements the Iterable interface to
enable access to all parts. In addition, it supports lookup by content ID. Data is read from the
stream on demand. This means that the stream must be kept open until all parts have been
processed or detach() has been called. It also means that any invocation of a method on
an instance of this class or an individual Part instance may trigger a
MIMEException if there is an I/O error on the stream or a MIME parsing error.
Instances of this class are created using a fluent builder; see builder().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic interface -
Method Summary
Modifier and TypeMethodDescriptionstatic MultipartBody.Builderbuilder()voiddetach()Get the MIME part with the given content ID.intGet the number of parts in this multipart.iterator()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
builder
-
getContentType
-
getPart
Get the MIME part with the given content ID.- Parameters:
contentID- the content ID of the part to retrieve- Returns:
- the MIME part, or
nullif the message doesn't have a part with the given content ID
-
getPartCount
public int getPartCount()Get the number of parts in this multipart.- Returns:
- the number of parts
-
getRootPart
-
iterator
-
detach
public void detach()
-