Methods Summary |
---|
public static android.drm.DrmUtils$ExtendedMetadataParser | getExtendedMetadataParser(byte[] extendedMetadata)Gets an instance of {@link DrmUtils.ExtendedMetadataParser}, which can be used to parse
extended metadata embedded in DRM constraint information.
return new ExtendedMetadataParser(extendedMetadata);
|
private static void | quietlyDispose(java.io.InputStream stream)
try {
if (null != stream) {
stream.close();
}
} catch (IOException e) {
// no need to care, at least as of now
}
|
private static void | quietlyDispose(java.io.OutputStream stream)
try {
if (null != stream) {
stream.close();
}
} catch (IOException e) {
// no need to care
}
|
static byte[] | readBytes(java.lang.String path)
File file = new File(path);
return readBytes(file);
|
static byte[] | readBytes(java.io.File file)
FileInputStream inputStream = new FileInputStream(file);
BufferedInputStream bufferedStream = new BufferedInputStream(inputStream);
byte[] data = null;
try {
int length = bufferedStream.available();
if (length > 0) {
data = new byte[length];
// read the entire data
bufferedStream.read(data);
}
} finally {
quietlyDispose(bufferedStream);
quietlyDispose(inputStream);
}
return data;
|
static void | removeFile(java.lang.String path)
File file = new File(path);
file.delete();
|
static void | writeToFile(java.lang.String path, byte[] data)
/* check for invalid inputs */
FileOutputStream outputStream = null;
if (null != path && null != data) {
try {
outputStream = new FileOutputStream(path);
outputStream.write(data);
} finally {
quietlyDispose(outputStream);
}
}
|