Package org.dellroad.msrp.msg
Class BoundaryInputStream
- java.lang.Object
 - 
- java.io.InputStream
 - 
- java.io.FilterInputStream
 - 
- org.dellroad.msrp.msg.BoundaryInputStream
 
 
 
 
- 
- All Implemented Interfaces:
 Closeable,AutoCloseable
public class BoundaryInputStream extends FilterInputStream
Reads from an underlyingInputStreamuntil an MSRP end-line boundary is encountered. 
- 
- 
Field Summary
- 
Fields inherited from class java.io.FilterInputStream
in 
 - 
 
- 
Constructor Summary
Constructors Constructor Description BoundaryInputStream(InputStream input, String transactionId)Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()bytegetFlagByte()Get the flag byte that was found in the boundary string.voidmark(int readlimit)Mark this instance.booleanmarkSupported()Determine if mark/reset is supported by this instance.intread()Read the next byte.intread(byte[] b, int off, int len)voidreset()Reset this instance.longskip(long n)- 
Methods inherited from class java.io.FilterInputStream
close, read 
- 
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
BoundaryInputStream
public BoundaryInputStream(InputStream input, String transactionId)
Constructor.- Parameters:
 input- underlying inputtransactionId- transaction ID- Throws:
 IllegalArgumentException- ifinputis nullIllegalArgumentException- iftransactionIdis null or invalid
 
 - 
 
- 
Method Detail
- 
read
public int read() throws IOExceptionRead the next byte.- Overrides:
 readin classFilterInputStream- Returns:
 - next byte prior to boundary, or -1 if the boundary has been seen
 - Throws:
 EOFException- if EOF is detected before the boundary is seenIOException- if an I/O error occurs
 
- 
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
 readin classFilterInputStream- Throws:
 IOException
 
- 
skip
public long skip(long n) throws IOException- Overrides:
 skipin classFilterInputStream- Throws:
 IOException
 
- 
available
public int available() throws IOException- Overrides:
 availablein classFilterInputStream- Throws:
 IOException
 
- 
mark
public void mark(int readlimit)
Mark this instance. This operation is not supported byBoundaryInputStream.- Overrides:
 markin classFilterInputStream- Throws:
 UnsupportedOperationException- always
 
- 
reset
public void reset()
Reset this instance. This operation is not supported byBoundaryInputStream.- Overrides:
 resetin classFilterInputStream- Throws:
 UnsupportedOperationException- always
 
- 
markSupported
public boolean markSupported()
Determine if mark/reset is supported by this instance. Mark/reset is not supported byBoundaryInputStream.- Overrides:
 markSupportedin classFilterInputStream- Returns:
 - false always
 
 
- 
getFlagByte
public byte getFlagByte()
Get the flag byte that was found in the boundary string.If this instance's
read()method has not yet returned -1, then the return value from this method is undefined.- Returns:
 - boundary flag byte
 
 
 - 
 
 -