de.vxart.net
Class MultipartMessage

java.lang.Object
  extended by de.vxart.net.MultipartMessage
All Implemented Interfaces:
java.lang.Iterable<MultipartMessage.Part>, java.util.Iterator<MultipartMessage.Part>

public class MultipartMessage
extends java.lang.Object
implements java.lang.Iterable<MultipartMessage.Part>, java.util.Iterator<MultipartMessage.Part>

Parses Multipart MIME Messages as defined in RFC 2046 with the exception that it relies on optional headers to parse the size of the data payload of each MIME part ("Content-Length" or "Content-Range") which are usually present in HTTP responses.

Author:
Philipp Reichart, philipp.reichart@vxart.de

Nested Class Summary
 class MultipartMessage.Part
           
 
Constructor Summary
MultipartMessage(java.io.InputStream input, java.lang.String boundary)
          Constructs a MultipartMessage that parses from the given stream using the specified boundary to separate parts.
 
Method Summary
 boolean hasNext()
          Returns true if there's a next part available.
 java.util.Iterator<MultipartMessage.Part> iterator()
          Returns an Iterator over all parts of this multipart message.
 MultipartMessage.Part next()
          Returns the next part from this multipart message.
 void remove()
          This method is unsupported for MultipartMessages.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipartMessage

public MultipartMessage(java.io.InputStream input,
                        java.lang.String boundary)
Constructs a MultipartMessage that parses from the given stream using the specified boundary to separate parts.

Parameters:
input - the stream to read the multipart MIME message from
boundary - the boundary used to delimit the MIME parts
Method Detail

iterator

public java.util.Iterator<MultipartMessage.Part> iterator()
Returns an Iterator over all parts of this multipart message.

Specified by:
iterator in interface java.lang.Iterable<MultipartMessage.Part>
Returns:
an Iterator over all parts

hasNext

public boolean hasNext()
Returns true if there's a next part available.

Specified by:
hasNext in interface java.util.Iterator<MultipartMessage.Part>
Returns:
true if there's a next part available, false otherwise

next

public MultipartMessage.Part next()
Returns the next part from this multipart message.

Specified by:
next in interface java.util.Iterator<MultipartMessage.Part>
Returns:
the next part from this multipart message

remove

public void remove()
This method is unsupported for MultipartMessages.

Specified by:
remove in interface java.util.Iterator<MultipartMessage.Part>
Throws:
java.lang.UnsupportedOperationException