| Constructor and Description |
|---|
UDPFramer() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accept(Buffer data)
Check whether the supplied data could be framed into a frame of this
type.
|
UDPPacket |
frame(IPPacket parent,
Buffer buffer)
Ask the framer to frame the buffer into a packet.
|
Protocol |
getProtocol() |
public Protocol getProtocol()
getProtocol in interface Framer<IPPacket,UDPPacket>public UDPPacket frame(IPPacket parent, Buffer buffer) throws IOException
Packet has not been parsed, just framed.frame in interface Framer<IPPacket,UDPPacket>parent - the parent frame or null if the frame doesn't have one.buffer - the buffer containing all the raw dataIOException - in case something goes wrong when reading data from the
bufferpublic boolean accept(Buffer data)
FramerFramer will read a few bytes in an effort to
figure out if the incoming data may be something it recognizes. E.g., a
HTTP Framer could check if the first bytes match "GET", "POST",
"PUT" and "DELETE" if if so assume that the payload indeed is HTTP and
therefore return true. Of course, you may never really know until you
actually have parsed the entire body but this method should return quick
and if turns out that the data isn't what it thought, throw an exception
and the framework will take care of it.Copyright © 2021. All Rights Reserved.