Package org.dellroad.msrp.msg
Class MsrpInputStream
- java.lang.Object
-
- java.io.InputStream
-
- java.io.FilterInputStream
-
- org.dellroad.msrp.msg.MsrpInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class MsrpInputStream extends FilterInputStream
Wraps anInputStreamand parses MSRP messages from the underlying input.
-
-
Field Summary
-
Fields inherited from class java.io.FilterInputStream
in
-
-
Constructor Summary
Constructors Constructor Description MsrpInputStream(InputStream input)Constructor.MsrpInputStream(InputStream input, MsrpInputParser parser)Primary constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MsrpInputParsergetParser()Get theMsrpInputParserassociated with this instance.MsrpMessagereadMsrpMessage()Read the nextMsrpMessagefrom the underlying input stream.-
Methods inherited from class java.io.FilterInputStream
available, close, mark, markSupported, read, read, read, reset, skip
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
MsrpInputStream
public MsrpInputStream(InputStream input)
Constructor. Uses aMsrpInputParserwith default parameters.- Parameters:
input- underlying input- Throws:
IllegalArgumentException- ifinputis null
-
MsrpInputStream
public MsrpInputStream(InputStream input, MsrpInputParser parser)
Primary constructor.- Parameters:
input- underlying inputparser- parser- Throws:
IllegalArgumentException- if either parameter is null
-
-
Method Detail
-
getParser
public MsrpInputParser getParser()
Get theMsrpInputParserassociated with this instance.- Returns:
- associated parser
-
readMsrpMessage
public MsrpMessage readMsrpMessage() throws IOException
Read the nextMsrpMessagefrom the underlying input stream.- Returns:
- next message read, or null if EOF is detected
- Throws:
IOException- if an I/O error occursProtocolException- if a protocol violation is detectedEOFException- if the remote side has closed the connection in the middle of a message
-
-