acg.blocks
Class PrincipalAO
java.lang.Object
|
+--acg.blocks.PrincipalAO
- public class PrincipalAO
- extends java.lang.Object
- implements ACGObject
The PrincipalAO
object represents principals in our protocol. Right
now it is using strings.
Constructor Summary |
PrincipalAO()
Constructs a new PrincipalAO object. |
PrincipalAO(java.lang.String id)
Construts a PrincipalAO object with the given string. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
PrincipalAO
public PrincipalAO()
- Constructs a new PrincipalAO object.
PrincipalAO
public PrincipalAO(java.lang.String id)
- Construts a PrincipalAO object with the given string.
getPrincipal
public java.lang.String getPrincipal()
- Returns:
- the string that represents this principal.
equals
public boolean equals(PrincipalAO pao)
- Parameters:
pao
- the PrincipalAO object to compare this with.- Returns:
- true if this object is equal to pao
setAny
public void setAny(boolean any)
- A do-nothing method. Here for compatibility with the interface.
- Specified by:
- setAny in interface ACGObject
- Tags copied from interface: ACGObject
- Parameters:
any
- True if the ACGObject should just return its data byte array.- See Also:
EncryptedAO
getTypeID
public byte getTypeID()
- Specified by:
- getTypeID in interface ACGObject
- Returns:
- a byte indicating this object is of type Principal
outputBytes
public byte[] outputBytes()
- Serializes this PrincipalAO object. The format is as follows:
1 Type ID byte, 1 length byte followed by data
Pos 0: TYPE_PRINCIPAL //type
Pos 1: 12 //length
Pos 2 to 13: Doantam Phan //sample content
- Specified by:
- outputBytes in interface ACGObject
- Returns:
- a byte array containing the serialized version of this PrincipalAO object.
inputBytes
public int inputBytes(byte[] input,
int start)
throws ACGException
- Deserializes this PrincipalAO object from the given input.
- Specified by:
- inputBytes in interface ACGObject
- Parameters:
input
- a byte array from which we deserialize the object.start
- the index at which to start deserializing this object.- Returns:
- the number of bytes that this PrincipalAO object took up.
- Throws:
- ACGException - if the input is of length less than 2.
main
public static void main(java.lang.String[] args)
throws java.lang.Exception
selfTest
public boolean selfTest()
throws ACGException