Module io.inverno.mod.http.base
Class GenericWebSocketFrame.GenericFactory
java.lang.Object
io.inverno.mod.http.base.internal.ws.GenericWebSocketFrame.GenericFactory
- All Implemented Interfaces:
WebSocketFrame.Factory
- Enclosing class:
GenericWebSocketFrame
public static class GenericWebSocketFrame.GenericFactory
extends Object
implements WebSocketFrame.Factory
Generic WebSocketFrame.Factory implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbinary(io.netty.buffer.ByteBuf data, boolean finalFragment) Creates a binary frame with the specified payload data.continuation(io.netty.buffer.ByteBuf data, boolean finalFragment) Creates a continuation frame with the specified payload data.ping(io.netty.buffer.ByteBuf data) Creates a ping frame with the specified payload data.pong(io.netty.buffer.ByteBuf data) Creates a pong frame with the specified payload data.text(io.netty.buffer.ByteBuf data, boolean finalFragment) Creates a text frame with the specified payload data.io.netty.handler.codec.http.websocketx.WebSocketFrametoUnderlyingWebSocketFrame(WebSocketFrame webSocketFrame) Converts the specified webSocketFrame to an underlying WebSocket frame.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.http.base.ws.WebSocketFrame.Factory
binary, text, text, text
-
Constructor Details
-
GenericFactory
public GenericFactory(int maxFrameSize) Creates a generic WebSocker frame factory.
- Parameters:
maxFrameSize- the maximum size of a frame
-
-
Method Details
-
binary
public WebSocketFrame binary(io.netty.buffer.ByteBuf data, boolean finalFragment) throws WebSocketException Description copied from interface:WebSocketFrame.FactoryCreates a binary frame with the specified payload data.
- Specified by:
binaryin interfaceWebSocketFrame.Factory- Parameters:
data- payload datafinalFragment- true to create a final frame, false otherwise- Returns:
- a new WebSocket frame
- Throws:
WebSocketException- if there was an error creating the frame
-
text
public WebSocketFrame text(io.netty.buffer.ByteBuf data, boolean finalFragment) throws WebSocketException Description copied from interface:WebSocketFrame.FactoryCreates a text frame with the specified payload data.
- Specified by:
textin interfaceWebSocketFrame.Factory- Parameters:
data- payload datafinalFragment- true to create a final frame, false otherwise- Returns:
- a new WebSocket frame
- Throws:
WebSocketException- if there was an error creating the frame
-
continuation
public WebSocketFrame continuation(io.netty.buffer.ByteBuf data, boolean finalFragment) throws WebSocketException Description copied from interface:WebSocketFrame.FactoryCreates a continuation frame with the specified payload data.
- Specified by:
continuationin interfaceWebSocketFrame.Factory- Parameters:
data- payload datafinalFragment- true to create a final frame, false otherwise- Returns:
- a new WebSocket frame
- Throws:
WebSocketException- if there was an error creating the frame
-
ping
Description copied from interface:WebSocketFrame.FactoryCreates a ping frame with the specified payload data.
Note that a ping frame must have a payload length of 125 bytes or less as defined by RFC 6455 Section 5.5.
- Specified by:
pingin interfaceWebSocketFrame.Factory- Parameters:
data- payload data- Returns:
- a new WebSocket frame
- Throws:
WebSocketException- if there was an error creating the frame
-
pong
Description copied from interface:WebSocketFrame.FactoryCreates a pong frame with the specified payload data.
Note that a pong frame must have a payload length of 125 bytes or less as defined by RFC 6455 Section 5.5.
- Specified by:
pongin interfaceWebSocketFrame.Factory- Parameters:
data- payload data- Returns:
- a new WebSocket frame
- Throws:
WebSocketException- if there was an error creating the frame
-
toUnderlyingWebSocketFrame
public io.netty.handler.codec.http.websocketx.WebSocketFrame toUnderlyingWebSocketFrame(WebSocketFrame webSocketFrame) throws WebSocketException Converts the specified webSocketFrame to an underlying WebSocket frame.
- Parameters:
webSocketFrame- a WebSocket frame.- Returns:
- an underlying Netty frame
- Throws:
WebSocketException- if there was an error creating the frame
-