org.apache.http.entity.mime
Class HttpMultipart

java.lang.Object
  extended by org.apache.james.mime4j.message.Multipart
      extended by org.apache.http.entity.mime.HttpMultipart
All Implemented Interfaces:
org.apache.james.mime4j.message.Body, org.apache.james.mime4j.message.Disposable

public class HttpMultipart
extends org.apache.james.mime4j.message.Multipart

An extension of the mime4j standard Multipart class, which is capable of operating either in the strict (fully RFC 822, RFC 2045, RFC 2046 compliant) or the browser compatible modes.

Author:
Oleg Kalnichevski

Constructor Summary
HttpMultipart(java.lang.String subType)
           
 
Method Summary
protected  java.lang.String getBoundary()
           
protected  java.nio.charset.Charset getCharset()
           
 HttpMultipartMode getMode()
           
 long getTotalLength()
          Determines the total length of the multipart content (content length of individual parts plus that of extra elements required to delimit the parts from one another).
 void setMode(HttpMultipartMode mode)
           
 void writeTo(java.io.OutputStream out)
          Writes out the content in the multipart/form encoding.
 void writeTo(java.io.OutputStream out, int mode)
           
 
Methods inherited from class org.apache.james.mime4j.message.Multipart
addBodyPart, dispose, getBodyParts, getEpilogue, getParent, getPreamble, getSubType, setBodyParts, setEpilogue, setParent, setPreamble, setSubType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HttpMultipart

public HttpMultipart(java.lang.String subType)
Method Detail

getMode

public HttpMultipartMode getMode()

setMode

public void setMode(HttpMultipartMode mode)

getCharset

protected java.nio.charset.Charset getCharset()

getBoundary

protected java.lang.String getBoundary()

writeTo

public void writeTo(java.io.OutputStream out)
             throws java.io.IOException
Writes out the content in the multipart/form encoding. This method produces slightly different formatting depending on its compatibility mode.

Throws:
java.io.IOException
See Also:
getMode()

writeTo

public void writeTo(java.io.OutputStream out,
                    int mode)
             throws java.io.IOException,
                    org.apache.james.mime4j.MimeException
Specified by:
writeTo in interface org.apache.james.mime4j.message.Body
Overrides:
writeTo in class org.apache.james.mime4j.message.Multipart
Throws:
java.io.IOException
org.apache.james.mime4j.MimeException

getTotalLength

public long getTotalLength()
Determines the total length of the multipart content (content length of individual parts plus that of extra elements required to delimit the parts from one another). If any of the @{link BodyPart}s contained in this object is of a streaming entity of unknown length the total length is also unknown.

This method buffers only a small amount of data in order to determine the total length of the entire entity. The content of individual parts is not buffered.

Returns:
total length of the multipart entity if known, -1 otherwise.


Copyright © 1999-2008 Apache Software Foundation. All Rights Reserved.