Class HashElement
- java.lang.Object
-
- org.jivesoftware.smackx.hashes.element.HashElement
-
- All Implemented Interfaces:
Element
,ExtensionElement
,FullyQualifiedElement
,NamedElement
,XmlLangElement
public class HashElement extends Object implements ExtensionElement
Represent a hash element.
-
-
Constructor Summary
Constructors Constructor Description HashElement(HashManager.ALGORITHM algorithm, byte[] hash)
Create a HashElement from pre-calculated values.HashElement(HashManager.ALGORITHM algorithm, String hashB64)
Create a HashElement from pre-calculated values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
HashManager.ALGORITHM
getAlgorithm()
Return the hash algorithm used in this HashElement.String
getElementName()
Returns the root element name.byte[]
getHash()
Return the checksum as a byte array.String
getHashB64()
Return the checksum as a base16 (hex) string.String
getNamespace()
Returns the root element XML namespace.int
hashCode()
CharSequence
toXML(XmlEnvironment enclosingNamespace)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement
getLanguage, getQName
-
-
-
-
Field Detail
-
ELEMENT
public static final String ELEMENT
- See Also:
- Constant Field Values
-
ATTR_ALGO
public static final String ATTR_ALGO
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HashElement
public HashElement(HashManager.ALGORITHM algorithm, byte[] hash)
Create a HashElement from pre-calculated values.- Parameters:
algorithm
- The algorithm which was used.hash
- the checksum as byte array.
-
HashElement
public HashElement(HashManager.ALGORITHM algorithm, String hashB64)
Create a HashElement from pre-calculated values.- Parameters:
algorithm
- the algorithm that was used.hashB64
- the checksum in base 64.
-
-
Method Detail
-
getAlgorithm
public HashManager.ALGORITHM getAlgorithm()
Return the hash algorithm used in this HashElement.- Returns:
- algorithm the algorithm.
-
getHash
public byte[] getHash()
Return the checksum as a byte array.- Returns:
- the hash.
-
getHashB64
public String getHashB64()
Return the checksum as a base16 (hex) string.- Returns:
- the hash.
-
getElementName
public String getElementName()
Description copied from interface:NamedElement
Returns the root element name.- Specified by:
getElementName
in interfaceNamedElement
- Returns:
- the element name.
-
getNamespace
public String getNamespace()
Description copied from interface:FullyQualifiedElement
Returns the root element XML namespace.- Specified by:
getNamespace
in interfaceFullyQualifiedElement
- Returns:
- the namespace.
-
toXML
public CharSequence toXML(XmlEnvironment enclosingNamespace)
-
-