com.google.api.ads.common.lib.utils
Class Media

java.lang.Object
  extended by com.google.api.ads.common.lib.utils.Media

public final class Media
extends Object

A utility class for retrieving media data.

Author:
Adam Rogal

Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMediaDataFromFile

public static byte[] getMediaDataFromFile(String fileName)
                                   throws IOException
Gets the media data byte[] located in fileName.

Parameters:
fileName - the media file to load
Returns:
the media data byte[] located in fileName
Throws:
IOException - if the media could not be read

getMediaDataFromFile

public static byte[] getMediaDataFromFile(File file)
                                   throws IOException
Gets the media data byte[] located in file.

Parameters:
file - the media file to load
Returns:
the media data byte[] located in file
Throws:
IOException - if the media could not be read

getMediaDataFromUrl

public static byte[] getMediaDataFromUrl(String url)
                                  throws IOException
Gets the media data byte[] located at url or null if the media could not be loaded.

Parameters:
url - the media URL to load
Returns:
the media data byte[] located at url
Throws:
IOException - if the media could not be read from the URL

getMediaDataFromUrl

public static byte[] getMediaDataFromUrl(URL url)
                                  throws IOException
Gets the media data byte[] located at url or null if the media could not be loaded.

Parameters:
url - the media URL to load
Returns:
the media data byte[] located at url
Throws:
IOException - if the media could not be read from the URL


Copyright © 2012. All Rights Reserved.