Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.history
Class HistoryID

java.lang.Object
  extended by net.java.sip.communicator.service.history.HistoryID

public class HistoryID
extends Object

Object used to uniquely identify a group of history records.

Author:
Alexander Pelov

Method Summary
static HistoryID createFromID(String[] id)
          Create a HistoryID from a valid ID.
static HistoryID createFromRawID(String[] rawid)
          Create a HistoryID from a raw ID.
 boolean equals(Object obj)
           
 String[] getID()
           
 int hashCode()
           
static String readableHash(String rawString)
          An one-way function returning a "human readable" containing no special characters.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

createFromRawID

public static HistoryID createFromRawID(String[] rawid)
Create a HistoryID from a raw ID. You can pass any kind of strings and they will be safely converted to valid IDs.


createFromID

public static HistoryID createFromID(String[] id)
                              throws IllegalArgumentException
Create a HistoryID from a valid ID. You should pass only valid IDs (ones produced from readableHash).

Throws:
IllegalArgumentException - Thrown if a string from the ID is not valid an exception.

getID

public String[] getID()

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

readableHash

public static String readableHash(String rawString)
An one-way function returning a "human readable" containing no special characters. All characters _, a-z, A-Z, 0-9 are kept unchainged. All other are replaced with _ and the word is postfixed with $HASHCODE, where HASHCODE is the hexadecimal hash value of the original string. If there are no special characters the word is not postfixed. Note: This method does not use URLEncoder, because in url-encoding the * sign is considered as "safe".

Parameters:
rawString - The string to be hashed.
Returns:
The human-readable hash.

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.