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