com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource Class Reference

OoyalaDrmHttpDataSource is a component from which streams of data can be read. More...

Inheritance diagram for com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource:

Classes

class  OoyalaInvalidResponseCodeException
 Thrown when an attempt to open a connection results in a response code not in the 2xx range. More...
 

Public Member Functions

 OoyalaDrmHttpDataSource (String userAgent, Predicate< String > contentTypePredicate)
 
 OoyalaDrmHttpDataSource (String userAgent, Predicate< String > contentTypePredicate, TransferListener listener)
 
 OoyalaDrmHttpDataSource (String userAgent, Predicate< String > contentTypePredicate, TransferListener listener, int connectTimeoutMillis, int readTimeoutMillis)
 
 OoyalaDrmHttpDataSource (String userAgent, Predicate< String > contentTypePredicate, TransferListener listener, int connectTimeoutMillis, int readTimeoutMillis, boolean allowCrossProtocolRedirects, RequestProperties defaultRequestProperties)
 
Uri getUri ()
 
Map< String, List< String > > getResponseHeaders ()
 
void setRequestProperty (String name, String value)
 
void clearRequestProperty (String name)
 
void clearAllRequestProperties ()
 
void addTransferListener (TransferListener transferListener)
 
long open (DataSpec dataSpec) throws HttpDataSourceException
 
int read (byte[] buffer, int offset, int readLength) throws HttpDataSourceException
 
void close () throws HttpDataSourceException
 

Static Public Attributes

static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 8 * 1000
 The default connection timeout, in milliseconds. More...
 
static final int DEFAULT_READ_TIMEOUT_MILLIS = 8 * 1000
 The default read timeout, in milliseconds. More...
 

Protected Member Functions

final HttpURLConnection getConnection ()
 Returns the current connection, or null if the source is not currently opened. More...
 
final long bytesSkipped ()
 Returns the number of bytes that have been skipped since the most recent call to open(DataSpec). More...
 
final long bytesRead ()
 Returns the number of bytes that have been read since the most recent call to open(DataSpec). More...
 
final long bytesRemaining ()
 Returns the number of bytes that are still to be read for the current DataSpec. More...
 

Detailed Description

OoyalaDrmHttpDataSource is a component from which streams of data can be read.

The class is created to obtain and parse a response body and throw a special OoyalaInvalidResponseCodeException if needed.

Constructor & Destructor Documentation

com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.OoyalaDrmHttpDataSource ( String  userAgent,
Predicate< String >  contentTypePredicate 
)
Parameters
userAgentThe User-Agent string that should be used.
contentTypePredicateAn optional Predicate. If a content type is rejected by the predicate then a HttpDataSource.InvalidContentTypeException is thrown from open(DataSpec).
com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.OoyalaDrmHttpDataSource ( String  userAgent,
Predicate< String >  contentTypePredicate,
TransferListener  listener 
)
Parameters
userAgentThe User-Agent string that should be used.
contentTypePredicateAn optional Predicate. If a content type is rejected by the predicate then a HttpDataSource.InvalidContentTypeException is thrown from open(DataSpec).
listenerAn optional listener. For more info check TransferListener.
com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.OoyalaDrmHttpDataSource ( String  userAgent,
Predicate< String >  contentTypePredicate,
TransferListener  listener,
int  connectTimeoutMillis,
int  readTimeoutMillis 
)
Parameters
userAgentThe User-Agent string that should be used.
contentTypePredicateAn optional Predicate. If a content type is rejected by the predicate then a HttpDataSource.InvalidContentTypeException is thrown from open(DataSpec).
listenerAn optional listener. For more info check TransferListener.
connectTimeoutMillisThe connection timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
readTimeoutMillisThe read timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout.
com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.OoyalaDrmHttpDataSource ( String  userAgent,
Predicate< String >  contentTypePredicate,
TransferListener  listener,
int  connectTimeoutMillis,
int  readTimeoutMillis,
boolean  allowCrossProtocolRedirects,
RequestProperties  defaultRequestProperties 
)
Parameters
userAgentThe User-Agent string that should be used.
contentTypePredicateAn optional Predicate. If a content type is rejected by the predicate then a HttpDataSource.InvalidContentTypeException is thrown from open(DataSpec).
listenerAn optional listener. For more info check TransferListener.
connectTimeoutMillisThe connection timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout. Pass DEFAULT_CONNECT_TIMEOUT_MILLIS to use the default value.
readTimeoutMillisThe read timeout, in milliseconds. A timeout of zero is interpreted as an infinite timeout. Pass DEFAULT_READ_TIMEOUT_MILLIS to use the default value.
allowCrossProtocolRedirectsWhether cross-protocol redirects (i.e. redirects from HTTP to HTTPS and vice versa) are enabled.
defaultRequestPropertiesThe default request properties to be sent to the server as HTTP headers or
null
if not required.

Member Function Documentation

void com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.addTransferListener ( TransferListener  transferListener)
final long com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.bytesRead ( )
protected

Returns the number of bytes that have been read since the most recent call to open(DataSpec).

Returns
The number of bytes read.
final long com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.bytesRemaining ( )
protected

Returns the number of bytes that are still to be read for the current DataSpec.

If the total length of the data being read is known, then this length minus

is returned. If the total length is unknown, C#LENGTH_UNSET is returned.

Returns
The remaining length, or C#LENGTH_UNSET.
final long com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.bytesSkipped ( )
protected

Returns the number of bytes that have been skipped since the most recent call to open(DataSpec).

Returns
The number of bytes skipped.
void com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.clearAllRequestProperties ( )
void com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.clearRequestProperty ( String  name)
void com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.close ( ) throws HttpDataSourceException
final HttpURLConnection com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.getConnection ( )
protected

Returns the current connection, or null if the source is not currently opened.

Returns
The current open connection, or null.
Map<String, List<String> > com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.getResponseHeaders ( )
Uri com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.getUri ( )
long com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.open ( DataSpec  dataSpec) throws HttpDataSourceException
int com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.read ( byte []  buffer,
int  offset,
int  readLength 
) throws HttpDataSourceException
void com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.setRequestProperty ( String  name,
String  value 
)

Member Data Documentation

final int com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.DEFAULT_CONNECT_TIMEOUT_MILLIS = 8 * 1000
static

The default connection timeout, in milliseconds.

final int com.ooyala.android.player.exoplayer.upstream.OoyalaDrmHttpDataSource.DEFAULT_READ_TIMEOUT_MILLIS = 8 * 1000
static

The default read timeout, in milliseconds.