public final class Media extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getMediaDataFromFile(File file)
Gets the media data
byte[] located in file. |
static byte[] |
getMediaDataFromFile(String fileName)
Gets the media data
byte[] located in fileName. |
static byte[] |
getMediaDataFromUrl(String url)
Gets the media data
byte[] located at url or
null if the media could not be loaded. |
static byte[] |
getMediaDataFromUrl(URL url)
Gets the media data
byte[] located at url or
null if the media could not be loaded. |
static void |
saveMediaDataToFile(byte[] mediaData,
File file)
Saves media data downloaded from an API in
byte[] format into a
file on the file system. |
static void |
saveMediaDataToFile(byte[] mediaData,
String fileName)
Saves media data downloaded from an API in
byte[] format into a
file on the file system. |
public static byte[] getMediaDataFromFile(String fileName) throws IOException
byte[] located in fileName.fileName - the media file to loadbyte[] located in fileNameIOException - if the media could not be readpublic static byte[] getMediaDataFromFile(File file) throws IOException
byte[] located in file.file - the media file to loadbyte[] located in fileIOException - if the media could not be readpublic static byte[] getMediaDataFromUrl(String url) throws IOException
byte[] located at url or
null if the media could not be loaded.url - the media URL to loadbyte[] located at urlIOException - if the media could not be read from the URLpublic static byte[] getMediaDataFromUrl(URL url) throws IOException
byte[] located at url or
null if the media could not be loaded.url - the media URL to loadbyte[] located at urlIOException - if the media could not be read from the URLpublic static void saveMediaDataToFile(byte[] mediaData,
String fileName)
throws FileNotFoundException,
IOException
byte[] format into a
file on the file system.mediaData - the media data byte[] to store on the file systemfileName - the name of the file on the file system to save the media
data intoFileNotFoundException - if the file exists but is a directory, does
not exist but cannot be created, or cannot be opened for any reasonIOException - if the file cannot be written topublic static void saveMediaDataToFile(byte[] mediaData,
File file)
throws FileNotFoundException,
IOException
byte[] format into a
file on the file system.mediaData - the media data byte[] to store on the file systemfile - the file on the file system to save the media data intoFileNotFoundException - if the file exists but is a directory, does
not exist but cannot be created, or cannot be opened for any reasonIOException - if the file cannot be written toCopyright © 2015. All Rights Reserved.