public final class MultiPartMIMEWriter
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
MultiPartMIMEWriter.Builder
Builder to create the MultiPartMIMEWriter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abortAllDataSources(java.lang.Throwable throwable)
Aborts all data sources contained with this
MultiPartMIMEWriter. |
java.lang.String |
getBoundary()
Returns the boundary that will be used by this writer between each part.
|
com.linkedin.r2.message.stream.entitystream.EntityStream |
getEntityStream()
This should never be used by external consumers.
|
public void abortAllDataSources(java.lang.Throwable throwable)
MultiPartMIMEWriter. This is useful
to invoke when many data sources have been collected and this MultiPartMIMEWriter has
been created, but an exception (or any other event) is observed and a StreamRequest
or a StreamResponse will no longer be sent. In such a case it is prudent to
clean up all data sources.
The abandon behavior can be different for each data source passed in.
1. If the data source passed in is a custom MultiPartMIMEDataSourceWriter, then it will be
invoked on Writer.onAbort(java.lang.Throwable). At this point
the custom data source can perform any cleanup necessary. Note that the custom MultiPartMIMEDataSourceWriter
will be able to see the Throwable that is passed into this method.
2. If the data source passed in is a MultiPartMIMEDataSourceIterator, then all data sources
represented by this MultiPartMIMEPartIterator will be read and abandoned. See MultiPartMIMEDataSourceIterator.abandonAllDataSources().
In this case the Throwable that is passed into this method will not be used.throwable - the Throwable that caused the abandonment to happen.public com.linkedin.r2.message.stream.entitystream.EntityStream getEntityStream()
EntityStream that will be used
for the StreamRequest or StreamResponse.EntityStream representing a Writer responsible
for writing the payload of a StreamRequest or
StreamResponse.public java.lang.String getBoundary()