org.opengroup.arm40.transaction.ArmToken Interface Reference
An abstract interface serving as a superclass of ArmCorrelator, ArmSystemAddress, and ArmID. More...
Public Member Functions | |
boolean | copyBytes (byte[] dest) |
Copies the token to a byte array that is already allocated. | |
boolean | copyBytes (byte[] dest, int offset) |
Copies the token to a byte array that is already allocated. | |
byte[] | getBytes () |
Returns a newly allocated byte array into which the token is copied. | |
int | getLength () |
Gets the length of the byte array part. |
Detailed Description
An abstract interface serving as a superclass of ArmCorrelator, ArmSystemAddress, and ArmID.
ArmToken
expresses the common part of the above interfaces. It is abstract in the sense that any ArmToken
object returned by any method in this specification satisfies one of the subclass interfaces. Objects of these identify particular entities. These objects contain a byte array data token, plus optionally other identifying data, which together comprise the value of the object. The data token is always immutable. Subclasses of ArmToken
can be thought of as wrappers around the data token.
To make it possible to compare the values of these tokens, and to use these tokens as hashkeys (so that the user can associate data with a particular token), this specification requires that any class implementing any of these types override the methods java.lang.Object#equals(java.lang.Object) and java.lang.Object#hashCode(). The behavior of these methods must be the following.
a.equals(b)
returns true
if the ArmToken
objects a
and b
have the same value (internal data is byte-for-byte identical in two objects). That is, a.equals(b)
is true if and only if:
-
a
andb
implement the same interfaceArmCorrelator
,ArmSystemAddress
, orArmID
. -
a.getBytes()
andb.getBytes()
would return byte arrays of identical lengths and contents. -
If a subclass of
ArmToken
defines other data values (specifically,ArmSystemAddress
defines a short field namedformat
), these other data values are all identical.
If a.equals(b)==true
, a.hashCode()
and b.hashCode()
will return the same value. The hashCode()
value is implementation-defined. In other words, hashcode values are not necessarily portable. A hashcode generated on one system by one implementation may not equal a hashcode value generated on another system by a different implementation, even if a.equals(b)==true
.
Member Function Documentation
boolean org.opengroup.arm40.transaction.ArmToken.copyBytes | ( | byte[] | dest | ) |
Copies the token to a byte array that is already allocated.
- Parameters:
-
dest destination byte array. Its length must be greater than or equal to the length of the token's byte array.
- Returns:
true
if the operation was successful,false
otherwise. Iffalse
, the contents of the target array are undetermined. The most likely errors are an attempt to copy into a null pointer or into an array that is not long enough to hold the entire token.
boolean org.opengroup.arm40.transaction.ArmToken.copyBytes | ( | byte[] | dest, | |
int | offset | |||
) |
Copies the token to a byte array that is already allocated.
- Parameters:
-
dest destination byte array. (dest.length-offset)
must be greater than or equal to the length of the token's byte array.offset offset in dest
to copying at.
- Returns:
true
if the operation was successful,false
otherwise. Iffalse
, the contents of the target array are undetermined. The most likely errors are an attempt to copy into a null pointer or into an array that is not long enough to hold the entire token.
byte [] org.opengroup.arm40.transaction.ArmToken.getBytes | ( | ) |
Returns a newly allocated byte array into which the token is copied.
This is equivalent to creating a byte array of length getLength()
and then executing copyBytes()
into the new array. The ARM implementation would typically not keep a reference to the array, because that would interfere with garbage collection.
- Returns:
- a byte array containing a copy of the token's byte array part.
int org.opengroup.arm40.transaction.ArmToken.getLength | ( | ) |
Gets the length of the byte array part.
- Returns:
- the size of the byte array part of the token.
The documentation for this interface was generated from the following file:
- org/opengroup/arm40/transaction/ArmToken.java