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 ByteBuffer
private final org.eclipse.jetty.io.ByteBufferPool
private final BlockingDeque
<ByteBuffer> private static final ByteBuffer
private static final org.eclipse.jetty.util.log.Logger
private final Session
private MessageInputStream.State
private SuspendToken
private final long
-
Constructor Summary
ConstructorsConstructorDescriptionMessageInputStream
(Session session) MessageInputStream
(Session session, int timeoutMs) -
Method Summary
Modifier and TypeMethodDescriptionprivate ByteBuffer
acquire
(int capacity, boolean direct) void
appendFrame
(ByteBuffer framePayload, boolean fin) Append the frame payload to the message.void
close()
void
void
mark
(int readlimit) boolean
void
Notification that message is to be considered complete.int
read()
int
read
(byte[] b, int off, int len) void
reset()
Methods inherited from class java.io.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:MessageAppender
Append the frame payload to the message.- Specified by:
appendFrame
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
-
handlerComplete
public void handlerComplete() -
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-
messageComplete
public void messageComplete()Description copied from interface:MessageAppender
Notification that message is to be considered complete.Any cleanup or final actions should be taken here.
- Specified by:
messageComplete
in interfaceMessageAppender
-
reset
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
mark
public void mark(int readlimit) - Overrides:
mark
in classInputStream
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classInputStream
-
acquire
-