Package org.dellroad.msrp
Class InputChunks
- java.lang.Object
-
- org.dellroad.msrp.InputChunks
-
public class InputChunks extends Object
Represents one incoming MSRP message reassembled from multipleSENDMsrpRequestchunks.
-
-
Constructor Summary
Constructors Constructor Description InputChunks(String messageId, long maxContentLength)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getContent()Get message content.StringgetContentType()Get message content type.FailureReportgetFailureReport()Determine what type of failure reporting this message requires.List<MsrpUri>getFromPath()Get From path.SortedSet<Header>getHeaders()Get other headers, sorted by header name case-insensitively.longgetIdleTime()Get idle time of this instance.StringgetMessageId()Get message ID.booleanhandleSend(MsrpRequest request)Handle an incoming SEND request for this message.booleanisAborted()Determine whether this instance was aborted.booleanisComplete()Determine whether this instance is complete.booleanisSuccessReport()Determine whether this message requires a success report.
-
-
-
Constructor Detail
-
InputChunks
public InputChunks(String messageId, long maxContentLength)
Constructor.- Parameters:
messageId- incoming message IDmaxContentLength- maximum allowed message content length- Throws:
IllegalArgumentException- ifmessageIdis null
-
-
Method Detail
-
handleSend
public boolean handleSend(MsrpRequest request) throws ProtocolException
Handle an incoming SEND request for this message. Also resets this instance's idle timer.- Parameters:
request- incoming SEND request associated with this message- Returns:
- true if this message is now complete (or aborted); false if more chunks are still required
- Throws:
IllegalArgumentException- ifrequestis nullIllegalArgumentException- ifrequestis not aSENDrequestIllegalArgumentException- ifrequesthas the wrong message IDProtocolException- if a protocol violation is detected
-
getIdleTime
public long getIdleTime()
Get idle time of this instance.- Returns:
- time in milliseconds since (construction or) the most recent invocation of
handleSend()
-
getMessageId
public String getMessageId()
Get message ID.- Returns:
- message ID
-
getContent
public byte[] getContent()
Get message content.- Returns:
- message content, or null if this message does not contain any content
-
getContentType
public String getContentType()
Get message content type.- Returns:
- message content type, or null if this message does not contain any content
-
getHeaders
public SortedSet<Header> getHeaders()
Get other headers, sorted by header name case-insensitively.- Returns:
- other headers
-
isComplete
public boolean isComplete()
Determine whether this instance is complete.- Returns:
- true if complete, otherwise false
-
isAborted
public boolean isAborted()
Determine whether this instance was aborted.- Returns:
- true if aborted, otherwise false
-
isSuccessReport
public boolean isSuccessReport()
Determine whether this message requires a success report.- Returns:
- true if this message requires a success report, otherwise false
-
getFailureReport
public FailureReport getFailureReport()
Determine what type of failure reporting this message requires.- Returns:
- failure reporting requirement
-
-