/** * Gets the media data {@code byte[]} located in {@code file}. * * @param file the media file to load * @return the media data {@code byte[]} located in {@code file} * @throws IOException if the media could not be read */ public static byte[] getMediaDataFromFile(File file) throws IOException { return getByteArrayFromStream(new FileInputStream(file)); }
/** * Gets the media data {@code byte[]} located at {@code url} or * {@code null} if the media could not be loaded. * * @param url the media URL to load * @return the media data {@code byte[]} located at {@code url} * @throws IOException if the media could not be read from the URL */ public static byte[] getMediaDataFromUrl(URL url) throws IOException { return getByteArrayFromStream(url.openStream()); }
/** * Gets the media data {@code byte[]} located in {@code file}. * * @param file the media file to load * @return the media data {@code byte[]} located in {@code file} * @throws IOException if the media could not be read */ public static byte[] getMediaDataFromFile(File file) throws IOException { return getByteArrayFromStream(new FileInputStream(file)); }
/** * Gets the media data {@code byte[]} located at {@code url} or * {@code null} if the media could not be loaded. * * @param url the media URL to load * @return the media data {@code byte[]} located at {@code url} * @throws IOException if the media could not be read from the URL */ public static byte[] getMediaDataFromUrl(URL url) throws IOException { return getByteArrayFromStream(url.openStream()); }