Class Data

    • Constructor Detail

      • Data

        public Data​(String cid)
        Constructs the data element with a content id. This constructor should be used for requesting data.
        Parameters:
        cid - The contend id.
      • Data

        public Data​(byte[] bytes,
                    String type)
        Constructs the data element. The content id (cid) is generated automatically (with SHA-1 algorithm).
        Parameters:
        bytes - The bytes.
        type - The type.
      • Data

        public Data​(byte[] bytes,
                    String type,
                    Integer maxAge)
        Constructs the data element. The content id (cid) is generated automatically (with SHA-1 algorithm).
        Parameters:
        bytes - The bytes.
        type - The type.
        maxAge - The max age.
    • Method Detail

      • createContendId

        public static String createContendId​(byte[] data)
        Creates the content id.

        The 'cid' value SHOULD be of the form algo+hash@bob.xmpp.org, where the "algo" is the hashing algorithm used (e.g., "sha1" for the SHA-1 algorithm as specified in RFC 3174 [11]) and the "hash" is the hex output of the algorithm applied to the binary data itself.

        Parameters:
        data - The data.
        Returns:
        The content id.
      • getContentId

        public final String getContentId()
        A Content-ID that can be mapped to a cid: URL as specified in RFC 2111. The 'cid' value SHOULD be of the form algo+hash@bob.xmpp.org, where the "algo" is the hashing algorithm used (e.g., "sha1" for the SHA-1 algorithm as specified in RFC 3174) and the "hash" is the hex output of the algorithm applied to the binary data itself.
        Returns:
        The content id.
      • getMaxAge

        public final Integer getMaxAge()
        A suggestion regarding how long (in seconds) to cache the data; the meaning matches the Max-Age attribute from RFC 2965.
        Returns:
        The max age.
      • getType

        public final String getType()
        The value of the 'type' attribute MUST match the syntax specified in RFC 2045. That is, the value MUST include a top-level media type, the "/" character, and a subtype; in addition, it MAY include one or more optional parameters (e.g., the "audio/ogg" MIME type in the example shown below includes a "codecs" parameter as specified in RFC 4281). The "type/subtype" string SHOULD be registered in the IANA MIME Media Types Registry, but MAY be an unregistered or yet-to-be-registered value.
        Returns:
        The type.
      • getBytes

        public final byte[] getBytes()
        Gets the bytes.
        Returns:
        The bytes.