public class ByteArrayIterator extends MultipartIterator implements java.util.Iterator<byte[]>
MultipartIterator.KeyedByContentId
dataSource, idGenerator, log
Constructor and Description |
---|
ByteArrayIterator(byte[] bytes)
Constructor.
|
ByteArrayIterator(java.io.InputStream in)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
byte[] |
getPart(int partNumber)
Get a BodyPart based on the it's position within the multipart.
|
byte[] |
getPart(java.lang.String id)
Get a part by the contentId.
|
boolean |
hasNext() |
protected void |
initIterator() |
byte[] |
next() |
int |
size()
Return the number of body parts in this mime multipart.
|
getContentType, getHeaders, getMessageID, remove
public ByteArrayIterator(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.MultiPartInput(InputStream, boolean)
public ByteArrayIterator(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.MultiPartInput(byte[], boolean)
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 hasNext()
hasNext
in interface java.util.Iterator<byte[]>
public byte[] next()
next
in interface java.util.Iterator<byte[]>
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public int size()
protected void initIterator() throws javax.mail.MessagingException, java.io.IOException
initIterator
in class MultipartIterator
javax.mail.MessagingException
java.io.IOException