public class DatagramProcessorImpl extends Object implements DatagramProcessor
Constructor and Description |
---|
DatagramProcessorImpl() |
Modifier and Type | Method and Description |
---|---|
IncomingDatagramMessage |
read(InetAddress receivedOnAddress,
DatagramPacket datagram)
Reads the datagram and instantiates a message.
|
protected IncomingDatagramMessage |
readRequestMessage(InetAddress receivedOnAddress,
DatagramPacket datagram,
ByteArrayInputStream is,
String requestMethod,
String httpProtocol) |
protected IncomingDatagramMessage |
readResponseMessage(InetAddress receivedOnAddress,
DatagramPacket datagram,
ByteArrayInputStream is,
int statusCode,
String statusMessage,
String httpProtocol) |
DatagramPacket |
write(OutgoingDatagramMessage message)
Creates a UDP datagram with the content of a message.
|
public IncomingDatagramMessage read(InetAddress receivedOnAddress, DatagramPacket datagram) throws UnsupportedDataException
DatagramProcessor
The message is either a UpnpRequest
or
a UpnpResponse
operation type.
read
in interface DatagramProcessor
receivedOnAddress
- The address of the socket on which this datagram was received.datagram
- The received UDP datagram.UnsupportedDataException
- If the datagram could not be read, or didn't contain required data.public DatagramPacket write(OutgoingDatagramMessage message) throws UnsupportedDataException
DatagramProcessor
The outgoing message might be a UpnpRequest
or a
UpnpResponse
.
write
in interface DatagramProcessor
message
- The outgoing datagram message.UnsupportedDataException
- If the datagram could not be created.protected IncomingDatagramMessage readRequestMessage(InetAddress receivedOnAddress, DatagramPacket datagram, ByteArrayInputStream is, String requestMethod, String httpProtocol) throws Exception
Exception
protected IncomingDatagramMessage readResponseMessage(InetAddress receivedOnAddress, DatagramPacket datagram, ByteArrayInputStream is, int statusCode, String statusMessage, String httpProtocol) throws Exception
Exception
Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.