Package org.eclipse.jetty.util
Class MultiPartOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- org.eclipse.jetty.util.MultiPartOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class MultiPartOutputStream extends FilterOutputStream
Handle a multipart MIME response.
-
-
Field Summary
Fields Modifier and Type Field Description static StringMULTIPART_MIXEDstatic StringMULTIPART_X_MIXED_REPLACE-
Fields inherited from class java.io.FilterOutputStream
out
-
-
Constructor Summary
Constructors Constructor Description MultiPartOutputStream(OutputStream out)MultiPartOutputStream(OutputStream out, String boundary)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()End the current part.StringgetBoundary()OutputStreamgetOut()voidstartPart(String contentType)Start creation of the next Content.voidstartPart(String contentType, String[] headers)Start creation of the next Content.voidwrite(byte[] b, int off, int len)-
Methods inherited from class java.io.FilterOutputStream
flush, write, write
-
Methods inherited from class java.io.OutputStream
nullOutputStream
-
-
-
-
Field Detail
-
MULTIPART_MIXED
public static final String MULTIPART_MIXED
- See Also:
- Constant Field Values
-
MULTIPART_X_MIXED_REPLACE
public static final String MULTIPART_X_MIXED_REPLACE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MultiPartOutputStream
public MultiPartOutputStream(OutputStream out) throws IOException
- Throws:
IOException
-
MultiPartOutputStream
public MultiPartOutputStream(OutputStream out, String boundary) throws IOException
- Throws:
IOException
-
-
Method Detail
-
close
public void close() throws IOExceptionEnd the current part.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterOutputStream- Throws:
IOException- IOException
-
getBoundary
public String getBoundary()
-
getOut
public OutputStream getOut()
-
startPart
public void startPart(String contentType) throws IOException
Start creation of the next Content.- Parameters:
contentType- the content type of the part- Throws:
IOException- if unable to write the part
-
startPart
public void startPart(String contentType, String[] headers) throws IOException
Start creation of the next Content.- Parameters:
contentType- the content type of the partheaders- the part headers- Throws:
IOException- if unable to write the part
-
write
public void write(byte[] b, int off, int len) throws IOException- Overrides:
writein classFilterOutputStream- Throws:
IOException
-
-