Package net.handle.hdllib
Class HandleValue
java.lang.Object
net.handle.hdllib.HandleValue
Represents a single handle value
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Comparator
<HandleValue> static final int
static final byte
static final byte
static final byte
-
Constructor Summary
ConstructorsConstructorDescriptionHandleValue
(int index, byte[] type, byte[] data) HandleValue
(int index, byte[] type, byte[] data, byte ttlType, int ttl, int timestamp, ValueReference[] references, boolean adminRead, boolean adminWrite, boolean publicRead, boolean publicWrite) HandleValue
(int index, String type, byte[] data) HandleValue
(int index, String type, String data) -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this HandleValueboolean
boolean
equalsIgnoreTimestamp
(HandleValue other) final boolean
final boolean
final boolean
final boolean
final byte[]
getData()
final String
final int
getIndex()
final String
final String
final ValueReference[]
final int
final Date
final String
final int
getTTL()
final byte
final byte[]
getType()
final String
int
hashCode()
final boolean
hasType
(byte[] someType) Returns whether or not this handle value has the given type.boolean
isExpired
(int now, int timeRetrieved) Given the current time and the time this value was retrieved from a handle server (in seconds), return true if this value is "stale" and should be retrieved again.final void
setAdminCanRead
(boolean newAdminRead) final void
setAdminCanWrite
(boolean newAdminWrite) final void
setAnyoneCanRead
(boolean newPublicRead) final void
setAnyoneCanWrite
(boolean newPublicWrite) final void
setData
(byte[] newData) final void
setIndex
(int newIndex) final void
setReferences
(ValueReference[] newReferences) final void
setTimestamp
(int newTimestamp) final void
setTTL
(int newTTL) final void
setTTLType
(byte newTTLType) final void
setType
(byte[] newType) toString()
static boolean
unorderedEquals
(HandleValue[] vals1, HandleValue[] vals2) static boolean
unorderedEqualsIgnoreTimestamp
(HandleValue[] vals1, HandleValue[] vals2)
-
Field Details
-
SUBTYPE_SEPARATOR
public static final byte SUBTYPE_SEPARATOR- See Also:
-
TTL_TYPE_RELATIVE
public static final byte TTL_TYPE_RELATIVE- See Also:
-
TTL_TYPE_ABSOLUTE
public static final byte TTL_TYPE_ABSOLUTE- See Also:
-
MAX_RECOGNIZED_TTL
public static final int MAX_RECOGNIZED_TTL- See Also:
-
INDEX_COMPARATOR
-
-
Constructor Details
-
HandleValue
public HandleValue() -
HandleValue
public HandleValue(int index, byte[] type, byte[] data) -
HandleValue
-
HandleValue
-
HandleValue
public HandleValue(int index, byte[] type, byte[] data, byte ttlType, int ttl, int timestamp, ValueReference[] references, boolean adminRead, boolean adminWrite, boolean publicRead, boolean publicWrite)
-
-
Method Details
-
getPermissionString
-
toDetailedString
-
toString
-
isExpired
public boolean isExpired(int now, int timeRetrieved) Given the current time and the time this value was retrieved from a handle server (in seconds), return true if this value is "stale" and should be retrieved again. -
hasType
public final boolean hasType(byte[] someType) Returns whether or not this handle value has the given type. This handles subtypes, so if you call hasType("URL") and the type of this handle value is "URL.METADATA" then this will return true. -
getDataAsString
-
getTypeAsString
-
getTimestampAsString
-
getNicerTimestampAsString
-
getTimestampAsDate
-
getIndex
public final int getIndex() -
setIndex
public final void setIndex(int newIndex) -
getType
public final byte[] getType() -
setType
public final void setType(byte[] newType) -
getData
public final byte[] getData() -
setData
public final void setData(byte[] newData) -
getTTLType
public final byte getTTLType() -
setTTLType
public final void setTTLType(byte newTTLType) -
getTTL
public final int getTTL() -
setTTL
public final void setTTL(int newTTL) -
getTimestamp
public final int getTimestamp() -
setTimestamp
public final void setTimestamp(int newTimestamp) -
getReferences
-
setReferences
-
getAdminCanRead
public final boolean getAdminCanRead() -
setAdminCanRead
public final void setAdminCanRead(boolean newAdminRead) -
getAdminCanWrite
public final boolean getAdminCanWrite() -
setAdminCanWrite
public final void setAdminCanWrite(boolean newAdminWrite) -
getAnyoneCanRead
public final boolean getAnyoneCanRead() -
setAnyoneCanRead
public final void setAnyoneCanRead(boolean newPublicRead) -
getAnyoneCanWrite
public final boolean getAnyoneCanWrite() -
setAnyoneCanWrite
public final void setAnyoneCanWrite(boolean newPublicWrite) -
duplicate
Returns a copy of this HandleValue -
hashCode
public int hashCode() -
equals
-
equalsIgnoreTimestamp
-
unorderedEquals
-
unorderedEqualsIgnoreTimestamp
-