DrmInfopublic class DrmInfo extends Object An entity class that describes the information required to send transactions
between a device and an online DRM server. The DRM framework achieves
server registration, license acquisition, and any other server-related transactions
by passing an instance of this class to {@link DrmManagerClient#processDrmInfo}.
The caller can retrieve the {@link DrmInfo} instance by passing a {@link DrmInfoRequest}
instance to {@link DrmManagerClient#acquireDrmInfo}. |
Fields Summary |
---|
private byte[] | mData | private final String | mMimeType | private final int | mInfoType | private final HashMap | mAttributes |
Constructors Summary |
---|
public DrmInfo(int infoType, byte[] data, String mimeType)Creates a DrmInfo object with the given parameters.
mInfoType = infoType;
mMimeType = mimeType;
mData = data;
if (!isValid()) {
final String msg = "infoType: " + infoType + "," +
"mimeType: " + mimeType + "," +
"data: " + data;
throw new IllegalArgumentException(msg);
}
| public DrmInfo(int infoType, String path, String mimeType)Creates a DrmInfo object with the given parameters.
mInfoType = infoType;
mMimeType = mimeType;
try {
mData = DrmUtils.readBytes(path);
} catch (IOException e) {
// As the given path is invalid,
// set mData = null, so that further processDrmInfo()
// call would fail with IllegalArgumentException because of mData = null
mData = null;
}
if (!isValid()) {
final String msg = "infoType: " + infoType + "," +
"mimeType: " + mimeType + "," +
"data: " + mData;
throw new IllegalArgumentException();
}
|
Methods Summary |
---|
public java.lang.Object | get(java.lang.String key)Retrieves the value of a given key.
return mAttributes.get(key);
| public byte[] | getData()Retrieves the trigger data associated with this object.
return mData;
| public int | getInfoType()Retrieves the information type associated with this object.
return mInfoType;
| public java.lang.String | getMimeType()Retrieves the MIME type associated with this object.
return mMimeType;
| boolean | isValid()Returns whether this instance is valid or not
return (null != mMimeType && !mMimeType.equals("")
&& null != mData && mData.length > 0 && DrmInfoRequest.isValidType(mInfoType));
| public java.util.Iterator | iterator()Retrieves an iterator object that you can use to iterate over the values associated with
this DrmInfo object.
return mAttributes.values().iterator();
| public java.util.Iterator | keyIterator()Retrieves an iterator object that you can use to iterate over the keys associated with
this DrmInfo object.
return mAttributes.keySet().iterator();
| public void | put(java.lang.String key, java.lang.Object value)Adds optional information as key-value pairs to this object. To add a custom object
to the DrmInfo object, you must override the {@link #toString} implementation.
mAttributes.put(key, value);
|
|