Class MessageInputStream
java.lang.Object
java.io.InputStream
org.eclipse.jetty.websocket.common.message.MessageInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable, MessageAppender
Support class for reading a (single) WebSocket BINARY message via a InputStream.
An InputStream that can access a queue of ByteBuffer payloads, along with expected InputStream blocking behavior.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteBufferprivate final org.eclipse.jetty.io.ByteBufferPoolprivate final BlockingDeque<ByteBuffer> private static final ByteBufferprivate static final org.eclipse.jetty.util.log.Loggerprivate final Sessionprivate MessageInputStream.Stateprivate SuspendTokenprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionMessageInputStream(Session session) MessageInputStream(Session session, int timeoutMs) -
Method Summary
Modifier and TypeMethodDescriptionprivate ByteBufferacquire(int capacity, boolean direct) voidappendFrame(ByteBuffer framePayload, boolean fin) Append the frame payload to the message.voidclose()voidvoidmark(int readlimit) booleanvoidNotification that message is to be considered complete.intread()intread(byte[] b, int off, int len) voidreset()Methods inherited from class InputStream
available, read, skip
-
Field Details
-
LOG
private static final org.eclipse.jetty.util.log.Logger LOG -
EOF
-
session
-
bufferPool
private final org.eclipse.jetty.io.ByteBufferPool bufferPool -
buffers
-
timeoutMs
private final long timeoutMs -
activeBuffer
-
suspendToken
-
state
-
-
Constructor Details
-
MessageInputStream
-
MessageInputStream
-
-
Method Details
-
appendFrame
Description copied from interface:MessageAppenderAppend the frame payload to the message.- Specified by:
appendFramein interfaceMessageAppender- Parameters:
framePayload- the frame payload to append.fin- flag indicating if this is the last part of the message or not.- Throws:
IOException- if unable to append the frame payload
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream
-
handlerComplete
public void handlerComplete() -
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
messageComplete
public void messageComplete()Description copied from interface:MessageAppenderNotification that message is to be considered complete.Any cleanup or final actions should be taken here.
- Specified by:
messageCompletein interfaceMessageAppender
-
reset
- Overrides:
resetin classInputStream- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
markin classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classInputStream
-
acquire
-