public final class Data
extends java.lang.Object
The implementation of the <data/>
element in the urn:xmpp:bob
namespace.
This class is immutable.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAMESPACE
urn:xmpp:bob
|
Constructor and Description |
---|
Data(byte[] bytes,
java.lang.String type)
Constructs the data element.
|
Data(byte[] bytes,
java.lang.String type,
java.lang.Integer maxAge)
Constructs the data element.
|
Data(java.lang.String cid)
Constructs the data element with a content id.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
createContendId(byte[] data)
Creates the content id.
|
byte[] |
getBytes()
Gets the bytes.
|
java.lang.String |
getContentId()
A Content-ID that can be mapped to a cid: URL as specified in RFC 2111.
|
java.lang.Integer |
getMaxAge()
A suggestion regarding how long (in seconds) to cache the data; the meaning matches the Max-Age attribute from RFC 2965.
|
java.lang.String |
getType()
The value of the ‘type’ attribute MUST match the syntax specified in RFC 2045.
|
public static final java.lang.String NAMESPACE
urn:xmpp:bob
public Data(java.lang.String cid)
Constructs the data element with a content id. This constructor should be used for requesting data.
cid
- The contend id.public Data(byte[] bytes, java.lang.String type)
Constructs the data element. The content id (cid) is generated automatically (with SHA-1 algorithm).
bytes
- The bytes.type
- The type.public Data(byte[] bytes, java.lang.String type, java.lang.Integer maxAge)
Constructs the data element. The content id (cid) is generated automatically (with SHA-1 algorithm).
bytes
- The bytes.type
- The type.maxAge
- The max age.public static java.lang.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.
data
- The data.public final java.lang.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.
public final java.lang.Integer getMaxAge()
A suggestion regarding how long (in seconds) to cache the data; the meaning matches the Max-Age attribute from RFC 2965.
public final java.lang.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.
public final byte[] getBytes()
Gets the bytes.
Copyright © 2014–2019 XMPP.rocks. All rights reserved.