|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.id.binaryID.BinaryID
public class BinaryID
A BinaryID
is a 256-byte, identifier.
This class should be immutable so that it is thread safe.
ID
,
IDFactory
,
Serialized FormField Summary | |
---|---|
static int |
dataOffset
location of the byte where the data starts. |
protected String |
encodedValue
Array that holds the length and the value of the id in base64 format. |
static byte |
flagCodatID
|
static byte |
flagGenericID
|
static byte |
flagModuleClassID
|
static byte |
flagModuleClassRoleID
|
static byte |
flagModuleSpecID
|
static byte |
flagPeerGroupID
|
static byte |
flagPeerID
|
static byte |
flagPipeID
|
static int |
flagsOffset
location of the byte designating its type. |
static int |
flagsSize
|
static BinaryID |
nullBinaryID
|
static String |
UUIDEncoded
|
Constructor Summary | |
---|---|
|
BinaryID()
Creates a null value ID. |
|
BinaryID(byte id)
Creates zero content ID of a specific type. |
|
BinaryID(byte type,
byte[] data,
boolean lengthIncluded)
Simple constructor that takes a binary array to signify the contents of the array. |
protected |
BinaryID(String encodedValue)
Creates a ID from a string. |
Method Summary | |
---|---|
String |
encodedValue()
|
boolean |
equals(Object target)
Compares two BinaryIDs for equality. |
String |
getID()
returns the raw encoded value. |
int |
hashCode()
Returns the hash code of the BinaryID WARNING: Do not use this hash as a network ID. |
byte[] |
toByteArray()
Returns the value of the ID as a binary array. |
byte[] |
toSizeIncludedByteArray()
Returns the value of the ID as a binary array without the size in byte zero. |
String |
toString()
Returns base 64 encoded value. |
byte |
type()
Return the type of ID. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static String UUIDEncoded
public static final int flagsSize
public static final byte flagPeerGroupID
public static final byte flagPeerID
public static final byte flagPipeID
public static final byte flagModuleClassID
public static final byte flagModuleClassRoleID
public static final byte flagModuleSpecID
public static final byte flagCodatID
public static final byte flagGenericID
public static final int flagsOffset
public static final int dataOffset
public static final BinaryID nullBinaryID
protected String encodedValue
Constructor Detail |
---|
public BinaryID()
public BinaryID(byte id)
protected BinaryID(String encodedValue)
encodedValue
- Value to convert ID.public BinaryID(byte type, byte[] data, boolean lengthIncluded)
type
- The Type of ID. Valid values: flagPeerGroupID,flagPeerID,flagPipeID,flagGenericIDdata
- the array of up to 256 bytes. Max is 256 if lengthIncluded is true or 255 if the first byte is the length-1.lengthIncluded
- Boolean that signifies if the first byte is the length of the bytes to follow.
RuntimeException
- Runtime exception trhown if array is not correct or if included, the array length does not match actual size.Method Detail |
---|
public byte[] toByteArray()
public byte[] toSizeIncludedByteArray()
Note that we assume the array size-1 equals the contents of byte zero.
public String encodedValue()
public int hashCode()
WARNING: Do not use this hash as a network ID. Use a stronger digest hash like SHA-1 to get the hash of the contents.
hashCode
in class Object
public boolean equals(Object target)
true: taget == this
false: target == null
true: taget.encodedValue == this.encodedValue
true: target instance of ID && ID==ID.nullID && nullBinaryID.encodedValue().equals( encodedValue())
false: all other posibilities
equals
in class Object
target
- the BidaryID to be compared against.
public byte type()
public String toString()
toString
in class Object
public String getID()
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |