org.fourthline.cling.transport.impl

## Class DatagramProcessorImpl

- java.lang.Object
- - org.fourthline.cling.transport.impl.DatagramProcessorImpl

- All Implemented Interfaces:
    DatagramProcessor

      public class DatagramProcessorImpl
      extends Object
      implements DatagramProcessor

  Default implementation.
  Author:
    Christian Bauer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatagramProcessorImpl()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DatagramProcessorImpl

          public DatagramProcessorImpl()

  - ### Method Detail

    - #### read

          public IncomingDatagramMessage read(InetAddress receivedOnAddress,
                                              DatagramPacket datagram)
                                       throws UnsupportedDataException

      Description copied from interface: `DatagramProcessor`
      Reads the datagram and instantiates a message.

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

      Specified by:
        `read` in interface `DatagramProcessor`
      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

          public DatagramPacket write(OutgoingDatagramMessage message)
                               throws UnsupportedDataException

      Description copied from interface: `DatagramProcessor`
      Creates a UDP datagram with the content of a message.

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

      Specified by:
        `write` in interface `DatagramProcessor`
      Parameters:
        `message` - The outgoing datagram message.
      Returns:
        An actual UDP datagram.
      Throws:
        `UnsupportedDataException` - If the datagram could not be created.

    - #### readRequestMessage

          protected IncomingDatagramMessage readRequestMessage(InetAddress receivedOnAddress,
                                                               DatagramPacket datagram,
                                                               ByteArrayInputStream is,
                                                               String requestMethod,
                                                               String httpProtocol)
                                                        throws Exception

      Throws:
        `Exception`

    - #### readResponseMessage

          protected IncomingDatagramMessage readResponseMessage(InetAddress receivedOnAddress,
                                                                DatagramPacket datagram,
                                                                ByteArrayInputStream is,
                                                                int statusCode,
                                                                String statusMessage,
                                                                String httpProtocol)
                                                         throws Exception

      Throws:
        `Exception`

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