Package rocks.xmpp.extensions.bob.model
Class Data
- java.lang.Object
-
- rocks.xmpp.extensions.bob.model.Data
-
public final class Data extends Object
The implementation of the<data/>
element in theurn:xmpp:bob
namespace.This class is immutable.
- See Also:
- XEP-0231: Bits of Binary, XML Schema
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
createContendId(byte[] data)
Creates the content id.byte[]
getBytes()
Gets the bytes.String
getContentId()
A Content-ID that can be mapped to a cid: URL as specified in RFC 2111.Integer
getMaxAge()
A suggestion regarding how long (in seconds) to cache the data; the meaning matches the Max-Age attribute from RFC 2965.String
getType()
The value of the 'type' attribute MUST match the syntax specified in RFC 2045.
-
-
-
Field Detail
-
NAMESPACE
public static final String NAMESPACE
urn:xmpp:bob- See Also:
- Constant Field Values
-
-
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.
-
-
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.
-
-