public class MultiPartMIMEReader.SinglePartMIMEReader extends java.lang.Object implements MultiPartMIMEDataSourceWriter
MultiPartMIMEReaderCallback.onNewPart(com.linkedin.multipart.MultiPartMIMEReader.SinglePartMIMEReader).
At this time, clients should register an instance of SinglePartMIMEReaderCallback
and then call requestPartData()
to start the flow of data.| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.lang.String> |
dataSourceHeaders()
Returns the headers for this part.
|
void |
drainPart()
Drains all bytes from this part and then notifies the registered callback (if present) on
SinglePartMIMEReaderCallback.onDrainComplete(). |
void |
onAbort(java.lang.Throwable e)
Please do not use.
|
void |
onInit(com.linkedin.r2.message.stream.entitystream.WriteHandle writeHandle)
Please do not use.
|
void |
onWritePossible()
Please do not use.
|
void |
registerReaderCallback(SinglePartMIMEReaderCallback callback)
This call registers a callback and commits to reading this part.
|
void |
requestPartData()
Reads bytes from this part and notifies the registered callback on
SinglePartMIMEReaderCallback.onPartDataAvailable(com.linkedin.data.ByteString). |
public void registerReaderCallback(SinglePartMIMEReaderCallback callback)
SinglePartBindException.callback - the callback to be invoked on in order to read datapublic void requestPartData()
SinglePartMIMEReaderCallback.onPartDataAvailable(com.linkedin.data.ByteString).
Usage of this API requires registration using a SinglePartMIMEReaderCallback.
Failure to do so will throw a SinglePartNotInitializedException.
If this part is fully consumed, meaning SinglePartMIMEReaderCallback.onFinished() has been called,
then any subsequent calls to requestPartData() will throw SinglePartFinishedException.
Since this is async and request queueing is not allowed, repetitive calls will result in
StreamBusyException.
If the r2 reader is done, either through an error or a proper finish, calls to requestPartData() will throw
SinglePartFinishedException.public void drainPart()
SinglePartMIMEReaderCallback.onDrainComplete().
Usage of this API does NOT require registration using a SinglePartMIMEReaderCallback.
If there is no callback registration then there is no notification provided upon completion of draining
this part.
If this part is fully consumed, meaning SinglePartMIMEReaderCallback.onFinished() has been called,
then any subsequent calls to drainPart() will throw SinglePartFinishedException.
Since this is async and request queueing is not allowed, repetitive calls will result in
StreamBusyException.
If the r2 reader is done, either through an error or a proper finish, calls to drainPart() will throw
SinglePartFinishedException.public java.util.Map<java.lang.String,java.lang.String> dataSourceHeaders()
Collections.emptyMap()dataSourceHeaders in interface MultiPartMIMEDataSourceWriterpublic void onInit(com.linkedin.r2.message.stream.entitystream.WriteHandle writeHandle)
onInit in interface com.linkedin.r2.message.stream.entitystream.Writerpublic void onWritePossible()
onWritePossible in interface com.linkedin.r2.message.stream.entitystream.Writerpublic void onAbort(java.lang.Throwable e)
onAbort in interface com.linkedin.r2.message.stream.entitystream.Writer