Package 

Class ReservationTokenAttribute

  • All Implemented Interfaces:

    
    public class ReservationTokenAttribute
    extends Attribute
                        

    The RESERVATION-TOKEN attribute contains a token that identifies a reservation port on a TURN server. The value is on 64 bits (8 bytes).

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Array<byte> getReservationToken() Returns a (cloned) byte array containing the reservationToken value of the reservationToken attribute.
      void setReservationToken(Array<byte> reservationToken) Copies the specified binary array into the the reservationToken value of the reservationToken attribute.
      Array<byte> encode() Returns a binary representation of this attribute.
      String getName() Returns the human readable name of this attribute.
      char getDataLength() Returns the length of this attribute's body.
      static ReservationTokenAttribute createNewReservationTokenAttribute() Creates a Reservation Token object.
      boolean equals(Object obj) Compares two STUN Attributes.
      String toString() Returns a string representation of the token.
      static String toString(Array<byte> reservationToken) Returns a string representation of the token.
      int hashCode() Returns the hash code of this Reservation-Token.
      • Methods inherited from class org.ice4j.attribute.Attribute

        getAttributeType, getLocationInMessage, setLocationInMessage
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getReservationToken

         Array<byte> getReservationToken()

        Returns a (cloned) byte array containing the reservationToken value of the reservationToken attribute.

      • setReservationToken

         void setReservationToken(Array<byte> reservationToken)

        Copies the specified binary array into the the reservationToken value of the reservationToken attribute.

        Parameters:
        reservationToken - the binary array containing the reservationToken.
      • encode

         Array<byte> encode()

        Returns a binary representation of this attribute.

      • getName

         String getName()

        Returns the human readable name of this attribute.

      • getDataLength

         char getDataLength()

        Returns the length of this attribute's body.

      • createNewReservationTokenAttribute

         static ReservationTokenAttribute createNewReservationTokenAttribute()

        Creates a Reservation Token object.The Reservation Token itself is generated using the following algorithm: The first 6 bytes of the id are given the value of System.currentTimeMillis(). Putting the right most bits first so that we get a more optimized equals() method.

      • equals

         boolean equals(Object obj)

        Compares two STUN Attributes. Two attributes are considered equal when they have the same type length and value.

        Parameters:
        obj - the object to compare this attribute with.
      • toString

         String toString()

        Returns a string representation of the token.

      • toString

         static String toString(Array<byte> reservationToken)

        Returns a string representation of the token.

        Parameters:
        reservationToken - the Reservation Token to convert into String.
      • hashCode

         int hashCode()

        Returns the hash code of this Reservation-Token.