public final class WebSocketUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
echoFrame(WebSocketChannel channel,
StreamSourceFrameChannel ws)
Echo back the frame to the sender
|
static ByteBuffer |
fromUtf8String(CharSequence utfString)
Create a
ByteBuffer which holds the UTF8 encoded bytes for the
given String . |
static <I extends StreamSourceChannel,O extends StreamSinkChannel> |
initiateTransfer(I source,
O sink,
ChannelListener<? super I> sourceListener,
ChannelListener<? super O> sinkListener,
ChannelExceptionHandler<? super I> readExceptionHandler,
ChannelExceptionHandler<? super O> writeExceptionHandler,
ByteBufferPool pool)
Deprecated.
|
static String |
toUtf8String(ByteBuffer... buffers) |
static String |
toUtf8String(ByteBuffer buffer) |
static long |
transfer(ReadableByteChannel source,
long count,
ByteBuffer throughBuffer,
WritableByteChannel sink)
Transfer the data from the source to the sink using the given through buffer to pass data through.
|
public static ByteBuffer fromUtf8String(CharSequence utfString)
ByteBuffer
which holds the UTF8 encoded bytes for the
given String
.utfString
- The String
to convertByteBuffer
which was createdpublic static String toUtf8String(ByteBuffer buffer)
public static String toUtf8String(ByteBuffer... buffers)
public static long transfer(ReadableByteChannel source, long count, ByteBuffer throughBuffer, WritableByteChannel sink) throws IOException
IOException
public static void echoFrame(WebSocketChannel channel, StreamSourceFrameChannel ws) throws IOException
IOException
@Deprecated public static <I extends StreamSourceChannel,O extends StreamSinkChannel> void initiateTransfer(I source, O sink, ChannelListener<? super I> sourceListener, ChannelListener<? super O> sinkListener, ChannelExceptionHandler<? super I> readExceptionHandler, ChannelExceptionHandler<? super O> writeExceptionHandler, ByteBufferPool pool)
source
- the source channelsink
- the target channelsourceListener
- the source listener to set and call when the transfer is complete, or null
to clear the listener at that timesinkListener
- the target listener to set and call when the transfer is complete, or null
to clear the listener at that timereadExceptionHandler
- the read exception handler to call if an error occurs during a read operationwriteExceptionHandler
- the write exception handler to call if an error occurs during a write operationpool
- the pool from which the transfer buffer should be allocatedCopyright © 2017 JBoss by Red Hat. All rights reserved.