Top Description Fields Constructors Methods
org.eclipse.jetty.websocket.core.messages

public Class ByteBufferMessageSink

extends AbstractMessageSink
Class Inheritance
Imports
java.lang.invoke.MethodHandle, .MethodType, java.nio.ByteBuffer, org.eclipse.jetty.io.ByteBufferCallbackAccumulator, .ByteBufferPool, .RetainableByteBuffer, org.eclipse.jetty.util.Callback, org.eclipse.jetty.websocket.core.CoreSession, .Frame, org.eclipse.jetty.websocket.core.exception.InvalidSignatureException, .MessageTooLargeException

A MessageSink implementation that accumulates BINARY frames into a message that is then delivered to the application function passed to the constructor in the form of a ByteBuffer.

Field Summary

Modifier and TypeField and Description
private ByteBufferCallbackAccumulator

Constructor Summary

AccessConstructor and Description
public
ByteBufferMessageSink(CoreSession
the WebSocket session
session
,
MethodHandle
the application function to invoke when a new message has been assembled
methodHandle
,
boolean
whether this MessageSink manages demand automatically
autoDemand
)

Creates a new ByteBufferMessageSink.

protected
ByteBufferMessageSink(CoreSession session, MethodHandle methodHandle, boolean autoDemand, boolean validateSignature)

Method Summary

Modifier and TypeMethod and Description
public void
accept(Frame
the frame to consume
frame
,
Callback
the callback to complete when the frame is consumed
callback
)

Implements org.eclipse.jetty.websocket.core.messages.MessageSink.accept.

Consumes the WebSocket frame, possibly asynchronously when this method has returned.

public void
fail(Throwable
the cause of the failure
failure
)

Overrides default org.eclipse.jetty.websocket.core.messages.MessageSink.fail.

Fails this MessageSink with the given cause.

protected void
invoke(MethodHandle methodHandle, ByteBuffer byteBuffer, Callback callback)

Inherited from org.eclipse.jetty.websocket.core.messages.AbstractMessageSink:
autoDemandgetCoreSessiongetMethodHandleisAutoDemand

Field Detail

accumulatorback to summary
private ByteBufferCallbackAccumulator accumulator

Constructor Detail

ByteBufferMessageSinkback to summary
public ByteBufferMessageSink(CoreSession session, MethodHandle methodHandle, boolean autoDemand)

Creates a new ByteBufferMessageSink.

Parameters
session:CoreSession

the WebSocket session

methodHandle:MethodHandle

the application function to invoke when a new message has been assembled

autoDemand:boolean

whether this MessageSink manages demand automatically

ByteBufferMessageSinkback to summary
protected ByteBufferMessageSink(CoreSession session, MethodHandle methodHandle, boolean autoDemand, boolean validateSignature)

Method Detail

acceptback to summary
public void accept(Frame frame, Callback callback)

Implements org.eclipse.jetty.websocket.core.messages.MessageSink.accept.

Doc from org.eclipse.jetty.websocket.core.messages.MessageSink.accept.

Consumes the WebSocket frame, possibly asynchronously when this method has returned.

The callback argument must be completed when the frame payload is consumed.

The demand for more frames must be explicitly invoked, or arranged to be invoked asynchronously, by the implementation of this method, by calling CoreSession#demand().

Parameters
frame:Frame

the frame to consume

callback:Callback

the callback to complete when the frame is consumed

Annotations
@Override
failback to summary
public void fail(Throwable failure)

Overrides default org.eclipse.jetty.websocket.core.messages.MessageSink.fail.

Doc from org.eclipse.jetty.websocket.core.messages.MessageSink.fail.

Fails this MessageSink with the given cause.

Parameters
failure:Throwable

the cause of the failure

Annotations
@Override
invokeback to summary
protected void invoke(MethodHandle methodHandle, ByteBuffer byteBuffer, Callback callback) throws Throwable