Class OpenPgpContentElement

  • All Implemented Interfaces:
    org.jivesoftware.smack.packet.Element, org.jivesoftware.smack.packet.ExtensionElement, org.jivesoftware.smack.packet.FullyQualifiedElement, org.jivesoftware.smack.packet.NamedElement, org.jivesoftware.smack.packet.XmlLangElement
    Direct Known Subclasses:
    EncryptedOpenPgpContentElement, SignElement

    public abstract class OpenPgpContentElement
    extends java.lang.Object
    implements org.jivesoftware.smack.packet.ExtensionElement
    This class describes an OpenPGP content element. It defines the elements and fields that OpenPGP content elements do have in common.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String ATTR_JID  
      static java.lang.String ATTR_STAMP  
      static java.lang.String ELEM_PAYLOAD  
      static java.lang.String ELEM_TIME  
      static java.lang.String ELEM_TO  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected OpenPgpContentElement​(java.util.Set<? extends org.jxmpp.jid.Jid> to, java.util.Date timestamp, java.util.List<org.jivesoftware.smack.packet.ExtensionElement> payload)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void addCommonXml​(org.jivesoftware.smack.util.XmlStringBuilder xml)  
      protected void ensureTimestampStringSet()  
      org.jivesoftware.smack.packet.ExtensionElement getExtension​(java.lang.String namespace)
      Returns the first extension of this stanza that has the given namespace.
      <PE extends org.jivesoftware.smack.packet.ExtensionElement>
      PE
      getExtension​(java.lang.String elementName, java.lang.String namespace)
      Returns the first extension that matches the specified element name and namespace, or null if it doesn't exist.
      java.util.List<org.jivesoftware.smack.packet.ExtensionElement> getExtensions()
      Return the payload of the message.
      java.util.List<org.jivesoftware.smack.packet.ExtensionElement> getExtensions​(java.lang.String elementName, java.lang.String namespace)
      Return a list of all extensions with the given element name and namespace.
      java.lang.String getNamespace()  
      java.util.Date getTimestamp()
      Return the timestamp on which the encrypted element has been created.
      java.util.Set<? extends org.jxmpp.jid.Jid> getTo()
      Return the set of recipients.
      java.io.InputStream toInputStream()
      Return a ByteArrayInputStream that reads the bytes of the XML representation of this element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.jivesoftware.smack.packet.Element

        toXML, toXML, toXML
      • Methods inherited from interface org.jivesoftware.smack.packet.FullyQualifiedElement

        getLanguage, getQName
      • Methods inherited from interface org.jivesoftware.smack.packet.NamedElement

        getElementName
    • Constructor Detail

      • OpenPgpContentElement

        protected OpenPgpContentElement​(java.util.Set<? extends org.jxmpp.jid.Jid> to,
                                        java.util.Date timestamp,
                                        java.util.List<org.jivesoftware.smack.packet.ExtensionElement> payload)
    • Method Detail

      • getTo

        public final java.util.Set<? extends org.jxmpp.jid.Jid> getTo()
        Return the set of recipients.
        Returns:
        recipients.
      • getTimestamp

        public final java.util.Date getTimestamp()
        Return the timestamp on which the encrypted element has been created. This should be checked for sanity by the client.
        Returns:
        timestamp.
      • getExtensions

        public final java.util.List<org.jivesoftware.smack.packet.ExtensionElement> getExtensions()
        Return the payload of the message.
        Returns:
        payload.
      • getExtensions

        public java.util.List<org.jivesoftware.smack.packet.ExtensionElement> getExtensions​(java.lang.String elementName,
                                                                                            java.lang.String namespace)
        Return a list of all extensions with the given element name and namespace.

        Changes to the returned set will update the stanza extensions, if the returned set is not the empty set.

        Parameters:
        elementName - the element name, must not be null.
        namespace - the namespace of the element(s), must not be null.
        Returns:
        a set of all matching extensions.
      • getExtension

        public org.jivesoftware.smack.packet.ExtensionElement getExtension​(java.lang.String namespace)
        Returns the first extension of this stanza that has the given namespace.

        When possible, use getExtension(String, String) instead.

        Parameters:
        namespace - the namespace of the extension that is desired.
        Returns:
        the stanza extension with the given namespace.
      • getExtension

        public <PE extends org.jivesoftware.smack.packet.ExtensionElement> PE getExtension​(java.lang.String elementName,
                                                                                           java.lang.String namespace)
        Returns the first extension that matches the specified element name and namespace, or null if it doesn't exist. If the provided elementName is null, only the namespace is matched. Extensions are are arbitrary XML elements in standard XMPP stanzas.
        Type Parameters:
        PE - type of the ExtensionElement.
        Parameters:
        elementName - the XML element name of the extension. (May be null)
        namespace - the XML element namespace of the extension.
        Returns:
        the extension, or null if it doesn't exist.
      • getNamespace

        public java.lang.String getNamespace()
        Specified by:
        getNamespace in interface org.jivesoftware.smack.packet.FullyQualifiedElement
      • ensureTimestampStringSet

        protected void ensureTimestampStringSet()
      • addCommonXml

        protected void addCommonXml​(org.jivesoftware.smack.util.XmlStringBuilder xml)
      • toInputStream

        public java.io.InputStream toInputStream()
        Return a ByteArrayInputStream that reads the bytes of the XML representation of this element.
        Returns:
        InputStream over xml.