-
- 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).
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringNAMEprivate Array<byte>reservationToken
-
Method Summary
Modifier and Type Method Description Array<byte>getReservationToken()Returns a (cloned) byte array containing the reservationToken value of the reservationToken attribute. voidsetReservationToken(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. StringgetName()Returns the human readable name of this attribute. chargetDataLength()Returns the length of this attribute's body. static ReservationTokenAttributecreateNewReservationTokenAttribute()Creates a Reservation Token object. booleanequals(Object obj)Compares two STUN Attributes. StringtoString()Returns a string representation of the token. static StringtoString(Array<byte> reservationToken)Returns a string representation of the token. inthashCode()Returns the hash code of this Reservation-Token. -
-
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.
-
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
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.
-
-
-
-