org.fourthline.cling.transport.spi

## Interface DatagramProcessor

- All Known Implementing Classes:
    DatagramProcessorImpl

      public interface DatagramProcessor

  Reads and creates UDP datagrams from and into UPnP messages.

  An implementation of this interface has to be thread-safe.

  Author:
    Christian Bauer

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `IncomingDatagramMessage` | `read(InetAddress receivedOnAddress, DatagramPacket datagram)` Reads the datagram and instantiates a message.
    `DatagramPacket` | `write(OutgoingDatagramMessage message)` Creates a UDP datagram with the content of a message.

- - ### Method Detail

    - #### read

          IncomingDatagramMessage read(InetAddress receivedOnAddress,
                                       DatagramPacket datagram)
                                throws UnsupportedDataException

      Reads the datagram and instantiates a message.

      The message is either a `UpnpRequest` or a `UpnpResponse` operation type.

      Parameters:
        `receivedOnAddress` - The address of the socket on which this datagram was received.
        `datagram` - The received UDP datagram.
      Returns:
        The populated instance.
      Throws:
        `UnsupportedDataException` - If the datagram could not be read, or didn't contain required data.

    - #### write

          DatagramPacket write(OutgoingDatagramMessage message)
                        throws UnsupportedDataException

      Creates a UDP datagram with the content of a message.

      The outgoing message might be a `UpnpRequest` or a `UpnpResponse`.

      Parameters:
        `message` - The outgoing datagram message.
      Returns:
        An actual UDP datagram.
      Throws:
        `UnsupportedDataException` - If the datagram could not be created.

Copyright © 2016 4th Line GmbH, Switzerland. All rights reserved.