aim4.msg.udp

## Class Proxy2RealAdapter

- java.lang.Object
- - aim4.msg.udp.Proxy2RealAdapter

-     public abstract class Proxy2RealAdapter
      extends Object

  The proxy vehicle to real vehicle message adapter.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Proxy2RealAdapter()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DataOutputStream` | `getDosWithHeader(ByteArrayOutputStream baos, double currentTime, UdpHeader.UdpMessageType type)` Builds a header for the type of this message, and writes it to a new DataOutputStream wrapped around a given ByteArrayOutputStream
    `static DatagramPacket` | `toDatagramPacket(Confirm msg, SocketAddress sa, double currentTime)` Construct a DatagramPacket of this confirm message
    `static DatagramPacket` | `toDatagramPacket(double distToFrontVehicle, SocketAddress sa, double currentTime)` Construct a DatagramPacket of this confirm message
    `static DatagramPacket` | `toDatagramPacket(Reject msg, SocketAddress sa, double currentTime)` Construct a DatagramPacket of this reject message

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

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

- - ### Constructor Detail

    - #### Proxy2RealAdapter

          public Proxy2RealAdapter()

  - ### Method Detail

    - #### toDatagramPacket

          public static DatagramPacket toDatagramPacket(Confirm msg,
                                        SocketAddress sa,
                                        double currentTime)
                                                 throws IOException

      Construct a DatagramPacket of this confirm message
      Parameters:
        `sa` - SocketAddress of the intended destination of the datagram
        `currentTime` - absolute time in seconds
      Returns:
        a DatagramPacket object which can be sent over UDP representing this message
      Throws:
        `IOException`

    - #### toDatagramPacket

          public static DatagramPacket toDatagramPacket(Reject msg,
                                        SocketAddress sa,
                                        double currentTime)
                                                 throws IOException

      Construct a DatagramPacket of this reject message
      Parameters:
        `sa` - SocketAddress of the intended destination of the datagram
        `currentTime` - absolute time in seconds
      Returns:
        a DatagramPacket object which can be sent over UDP representing this message
      Throws:
        `IOException`

    - #### toDatagramPacket

          public static DatagramPacket toDatagramPacket(double distToFrontVehicle,
                                        SocketAddress sa,
                                        double currentTime)
                                                 throws IOException

      Construct a DatagramPacket of this confirm message
      Parameters:
        `distToFrontVehicle` - the distance of the vehicles in front
        `sa` - SocketAddress of the intended destination of the datagram
        `currentTime` - absolute time in seconds
      Returns:
        a DatagramPacket object which can be sent over UDP representing this message
      Throws:
        `IOException`

    - #### getDosWithHeader

          public static DataOutputStream getDosWithHeader(ByteArrayOutputStream baos,
                                          double currentTime,
                                          UdpHeader.UdpMessageType type)
                                                   throws IOException

      Builds a header for the type of this message, and writes it to a new DataOutputStream wrapped around a given ByteArrayOutputStream
      Parameters:
        `baos` - The ByteArrayOutputStream
        `currentTime` - The current, absolute time in seconds
      Returns:
        A DataOutputStream object backed by the given baos containing a UdpHeader
      Throws:
        `IOException`

Copyright © 2013. All rights reserved.