MultipartIterator
concrete sub-classes instead.@Deprecated
@Removal(version="3.10.0")
public class MultiPartInput
extends java.lang.Object
implements java.util.Enumeration, java.util.Iterator
This offers, by default, a simplified model for processing all the body parts iteratively, however access to the underlying MimeBodyPart is available depending on the constructor that is used.
A multi-part mime payload would look something similar to
Message-ID: db03b6ef-ffff-ffc0-019b-04e2b47a4d8e
Mime-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1_33189144.1047351507632"
Content-Length: 383
------=_Part_1_33189144.1047351507632
Content-Id: AdaptrisMessage/payload
This is the message 03/11/2003 01:57 PM
------=_Part_1_33189144.1047351507632
Content-Id: AdaptrisMessage/metadata
workflowId=loopback
previousGuid=db03b6ef-ffff-ffc0-019b-04e2b47a4d8e
emailmessageid=<200303110257.h2B2v9sC030299@localhost.localdomain>
------=_Part_1_33189144.1047351507632--
The Content-Length header is ignored for the purposes of parsing the multi-part mime message, the multipart is considered finished, when the final mime boundary occurs. If Content-Length needs to be taken into account then a specific DataSource should be used as the parameter to the constructor.
Constructor and Description |
---|
MultiPartInput(byte[] bytes)
Deprecated.
Constructor.
|
MultiPartInput(byte[] bytes,
boolean simplified)
Deprecated.
Constructor.
|
MultiPartInput(javax.activation.DataSource ds)
Deprecated.
Constructor.
|
MultiPartInput(javax.activation.DataSource ds,
boolean simplified)
Deprecated.
Constructor.
|
MultiPartInput(java.io.InputStream in)
Deprecated.
Constructor.
|
MultiPartInput(java.io.InputStream in,
boolean simplified)
Deprecated.
Constructor.
|
Modifier and Type | Method and Description |
---|---|
javax.mail.internet.MimeBodyPart |
getBodyPart(int partNumber)
Deprecated.
Get a BodyPart based on the it's position within the multipart.
|
javax.mail.internet.MimeBodyPart |
getBodyPart(java.lang.String id)
Deprecated.
Get a BodyPart based on the id.
|
java.lang.String |
getContentType()
Deprecated.
Convenience Method to get the content-Type
|
javax.activation.DataSource |
getDataSource()
Deprecated.
Return the underlying data source used to parse this mime multipart.
|
java.lang.String |
getName()
Deprecated.
Convenience Method to get the name from the underlying datasource.
|
byte[] |
getPart(int partNumber)
Deprecated.
Get a BodyPart based on the it's position within the multipart.
|
byte[] |
getPart(java.lang.String id)
Deprecated.
Get a part by the contentId.
|
boolean |
hasMoreElements()
Deprecated.
|
boolean |
hasNext()
Deprecated.
|
java.lang.Object |
next()
Deprecated.
|
java.lang.Object |
nextElement()
Deprecated.
|
void |
remove()
Deprecated.
|
int |
size()
Deprecated.
Return the number of body parts in this mime multipart.
|
public MultiPartInput(java.io.InputStream in) throws java.io.IOException, javax.mail.MessagingException
in
- the Inputstream from which to parse the mime multi-partjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartjava.io.IOException
- if there was an IOExceptionjavax.mail.MessagingException
- if an underlying javax.mail exception occurredMultiPartInput(InputStream, boolean)
public MultiPartInput(java.io.InputStream in, boolean simplified) throws java.io.IOException, javax.mail.MessagingException
in
- the Inputstream from which to parse the mime multi-partsimplified
- whether the iterator / enumeration should simply return
the content body as a byte array rather than a MimeBodyPartjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartjava.io.IOException
- if there was an IOExceptionjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartMultiPartInput(DataSource, boolean)
public MultiPartInput(byte[] bytes) throws java.io.IOException, javax.mail.MessagingException
bytes
- the byte array where the mime multi-part is.javax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartjava.io.IOException
- if there was an IOExceptionjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartMultiPartInput(byte[], boolean)
public MultiPartInput(byte[] bytes, boolean simplified) throws java.io.IOException, javax.mail.MessagingException
bytes
- the bytes from which to parse the mime multipart.simplified
- whether the iterator / enumeration should simply return
the content body as a byte array rather than a MimeBodyPartjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartjava.io.IOException
- if there was an IOExceptionInputStreamDataSource
public MultiPartInput(javax.activation.DataSource ds) throws java.io.IOException, javax.mail.MessagingException
ds
- the Datasource from which to parse the mime multipart.javax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartjava.io.IOException
- if there was an IOExceptionjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartInputStreamDataSource
,
MultiPartInput(DataSource, boolean)
public MultiPartInput(javax.activation.DataSource ds, boolean simplified) throws java.io.IOException, javax.mail.MessagingException
ds
- the Datasource from which to parse the mime multipart.simplified
- whether the iterator / enumeration should simply return
the content body as a byte array rather than a MimeBodyPartjavax.mail.MessagingException
- if the bytes did not contain a valid
MimeMultiPartjava.io.IOException
- if there was an IOExceptionInputStreamDataSource
public javax.mail.internet.MimeBodyPart getBodyPart(java.lang.String id)
Although it is unlikely that the Content-Id will re-occur across a mime multi-part, this is possible, so use of this method may not return the expected body part.
id
- the defining content-id.public javax.mail.internet.MimeBodyPart getBodyPart(int partNumber)
partNumber
- the part position (starts from 0).public byte[] getPart(java.lang.String id)
Although it is unlikely that the Content-Id will re-occur across a mime multi-part, this is possible, so use of this method may not return the expected body part.
id
- the defining content-id.public byte[] getPart(int partNumber)
partNumber
- the part position (starts from 0).public boolean hasMoreElements()
hasMoreElements
in interface java.util.Enumeration
Enumeration.hasMoreElements()
public java.lang.Object nextElement()
nextElement
in interface java.util.Enumeration
Enumeration.nextElement()
,
next()
public boolean hasNext()
hasNext
in interface java.util.Iterator
Iterator.hasNext()
public java.lang.Object next()
next
in interface java.util.Iterator
Iterator.next()
public void remove()
remove
in interface java.util.Iterator
Iterator.remove()
public int size()
public javax.activation.DataSource getDataSource()
DataSource
,
InputStreamDataSource
public java.lang.String getContentType()
DataSource.getContentType()
public java.lang.String getName()
DataSource.getName()