media/docs/doc/reference/com/google/android/exoplayer2/upstream/DefaultDataSource.html
olly a038f875f6 Update Javadoc for 2.14.0
#minor-release

PiperOrigin-RevId: 373351935
2021-05-12 13:55:32 +01:00

627 lines
39 KiB
HTML

<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head><!-- start favicons snippet, use https://realfavicongenerator.net/ --><link rel="apple-touch-icon" sizes="180x180" href="/assets/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/assets/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/assets/favicon-16x16.png"><link rel="manifest" href="/assets/site.webmanifest"><link rel="mask-icon" href="/assets/safari-pinned-tab.svg" color="#fc4d50"><link rel="shortcut icon" href="/assets/favicon.ico"><meta name="msapplication-TileColor" content="#ffc40d"><meta name="msapplication-config" content="/assets/browserconfig.xml"><meta name="theme-color" content="#ffffff"><!-- end favicons snippet -->
<title>DefaultDataSource (ExoPlayer library)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
<![endif]-->
<script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script>
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="DefaultDataSource (ExoPlayer library)";
}
}
catch(err) {
}
//-->
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
var pathtoroot = "../../../../../";
var useModuleDirectories = false;
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<div class="fixedNav">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a id="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<ul class="navListSearch">
<li><label for="search">SEARCH:</label>
<input type="text" id="search" value="search" disabled="disabled">
<input type="reset" id="reset" value="reset" disabled="disabled">
</li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
</div>
<div class="navPadding">&nbsp;</div>
<script type="text/javascript"><!--
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
//-->
</script>
</nav>
</header>
<!-- ======== START OF CLASS DATA ======== -->
<main role="main">
<div class="header">
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">com.google.android.exoplayer2.upstream</a></div>
<h2 title="Class DefaultDataSource" class="title">Class DefaultDataSource</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li>com.google.android.exoplayer2.upstream.DefaultDataSource</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><code><a href="DataReader.html" title="interface in com.google.android.exoplayer2.upstream">DataReader</a></code>, <code><a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></code></dd>
</dl>
<hr>
<pre>public final class <span class="typeNameLabel">DefaultDataSource</span>
extends <a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">Object</a>
implements <a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></pre>
<div class="block">A <a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream"><code>DataSource</code></a> that supports multiple URI schemes. The supported schemes are:
<ul>
<li>file: For fetching data from a local file (e.g. file:///path/to/media/media.mp4, or just
/path/to/media/media.mp4 because the implementation assumes that a URI without a scheme is
a local file URI).
<li>asset: For fetching data from an asset in the application's apk (e.g. asset:///media.mp4).
<li>rawresource: For fetching data from a raw resource in the application's apk (e.g.
rawresource:///resourceId, where rawResourceId is the integer identifier of the raw
resource).
<li>android.resource: For fetching data in the application's apk (e.g.
android.resource:///resourceId or android.resource://resourceType/resourceName). See <a href="RawResourceDataSource.html" title="class in com.google.android.exoplayer2.upstream"><code>RawResourceDataSource</code></a> for more information about the URI form.
<li>content: For fetching data from a content URI (e.g. content://authority/path/123).
<li>rtmp: For fetching data over RTMP. Only supported if the project using ExoPlayer has an
explicit dependency on ExoPlayer's RTMP extension.
<li>data: For parsing data inlined in the URI as defined in RFC 2397.
<li>udp: For fetching data over UDP (e.g. udp://something.com/media).
<li>http(s): For fetching data over HTTP and HTTPS (e.g. https://www.something.com/media.mp4),
if constructed using <a href="#%3Cinit%3E(android.content.Context,java.lang.String,boolean)"><code>DefaultDataSource(Context, String, boolean)</code></a>, or any other
schemes supported by a base data source if constructed using <a href="#%3Cinit%3E(android.content.Context,com.google.android.exoplayer2.upstream.DataSource)"><code>DefaultDataSource(Context, DataSource)</code></a>.
</ul></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<ul class="blockList">
<li class="blockList"><a id="nested.classes.inherited.from.class.com.google.android.exoplayer2.upstream.DataSource">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface&nbsp;com.google.android.exoplayer2.upstream.<a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></h3>
<code><a href="DataSource.Factory.html" title="interface in com.google.android.exoplayer2.upstream">DataSource.Factory</a></code></li>
</ul>
</li>
</ul>
</section>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Constructor</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(android.content.Context,boolean)">DefaultDataSource</a></span>&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
boolean&nbsp;allowCrossProtocolRedirects)</code></th>
<td class="colLast">
<div class="block">Constructs a new instance, optionally configured to follow cross-protocol redirects.</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(android.content.Context,com.google.android.exoplayer2.upstream.DataSource)">DefaultDataSource</a></span>&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
<a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a>&nbsp;baseDataSource)</code></th>
<td class="colLast">
<div class="block">Constructs a new instance that delegates to a provided <a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream"><code>DataSource</code></a> for URI schemes other
than file, asset and content.</div>
</td>
</tr>
<tr class="altColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(android.content.Context,java.lang.String,boolean)">DefaultDataSource</a></span>&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
<a href="https://developer.android.com/reference/java/lang/String.html" title="class or interface in java.lang" class="externalLink" target="_top">String</a>&nbsp;userAgent,
boolean&nbsp;allowCrossProtocolRedirects)</code></th>
<td class="colLast">
<div class="block">Constructs a new instance, optionally configured to follow cross-protocol redirects.</div>
</td>
</tr>
<tr class="rowColor">
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(android.content.Context,java.lang.String,int,int,boolean)">DefaultDataSource</a></span>&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
<a href="https://developer.android.com/reference/java/lang/String.html" title="class or interface in java.lang" class="externalLink" target="_top">String</a>&nbsp;userAgent,
int&nbsp;connectTimeoutMillis,
int&nbsp;readTimeoutMillis,
boolean&nbsp;allowCrossProtocolRedirects)</code></th>
<td class="colLast">
<div class="block">Constructs a new instance, optionally configured to follow cross-protocol redirects.</div>
</td>
</tr>
</table>
</li>
</ul>
</section>
<!-- ========== METHOD SUMMARY =========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colSecond" scope="col">Method</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addTransferListener(com.google.android.exoplayer2.upstream.TransferListener)">addTransferListener</a></span>&#8203;(<a href="TransferListener.html" title="interface in com.google.android.exoplayer2.upstream">TransferListener</a>&nbsp;transferListener)</code></th>
<td class="colLast">
<div class="block">Adds a <a href="TransferListener.html" title="interface in com.google.android.exoplayer2.upstream"><code>TransferListener</code></a> to listen to data transfers.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#close()">close</a></span>()</code></th>
<td class="colLast">
<div class="block">Closes the source.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/java/util/Map.html" title="class or interface in java.util" class="externalLink">Map</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,&#8203;<a href="https://developer.android.com/reference/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_top">String</a>&gt;&gt;</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getResponseHeaders()">getResponseHeaders</a></span>()</code></th>
<td class="colLast">
<div class="block">When the source is open, returns the response headers associated with the last <a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)</code></a>
call.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink" target="_top">Uri</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#getUri()">getUri</a></span>()</code></th>
<td class="colLast">
<div class="block">When the source is open, returns the <a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink" target="_top"><code>Uri</code></a> from which data is being read.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>long</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#open(com.google.android.exoplayer2.upstream.DataSpec)">open</a></span>&#8203;(<a href="DataSpec.html" title="class in com.google.android.exoplayer2.upstream">DataSpec</a>&nbsp;dataSpec)</code></th>
<td class="colLast">
<div class="block">Opens the source to read the specified data.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>int</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#read(byte%5B%5D,int,int)">read</a></span>&#8203;(byte[]&nbsp;buffer,
int&nbsp;offset,
int&nbsp;readLength)</code></th>
<td class="colLast">
<div class="block">Reads up to <code>length</code> bytes of data from the input.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="https://developer.android.com/reference/java/lang/Object.html" title="class or interface in java.lang" class="externalLink" target="_top">Object</a></h3>
<code><a href="https://developer.android.com/reference/java/lang/Object.html#clone()" title="class or interface in java.lang" class="externalLink">clone</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang" class="externalLink">equals</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang" class="externalLink">finalize</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang" class="externalLink">getClass</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang" class="externalLink">hashCode</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang" class="externalLink">notify</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang" class="externalLink">notifyAll</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang" class="externalLink">toString</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang" class="externalLink">wait</a>, <a href="https://developer.android.com/reference/java/lang/Object.html?is-external=true#wait(long,int)" title="class or interface in java.lang" class="externalLink" target="_top">wait</a></code></li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a id="&lt;init&gt;(android.content.Context,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DefaultDataSource</h4>
<pre>public&nbsp;DefaultDataSource&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
boolean&nbsp;allowCrossProtocolRedirects)</pre>
<div class="block">Constructs a new instance, optionally configured to follow cross-protocol redirects.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - A context.</dd>
</dl>
</li>
</ul>
<a id="&lt;init&gt;(android.content.Context,java.lang.String,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DefaultDataSource</h4>
<pre>public&nbsp;DefaultDataSource&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
@Nullable
<a href="https://developer.android.com/reference/java/lang/String.html" title="class or interface in java.lang" class="externalLink" target="_top">String</a>&nbsp;userAgent,
boolean&nbsp;allowCrossProtocolRedirects)</pre>
<div class="block">Constructs a new instance, optionally configured to follow cross-protocol redirects.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - A context.</dd>
<dd><code>userAgent</code> - The user agent that will be used when requesting remote data, or <code>null</code>
to use the default user agent of the underlying platform.</dd>
<dd><code>allowCrossProtocolRedirects</code> - Whether cross-protocol redirects (i.e. redirects from HTTP
to HTTPS and vice versa) are enabled when fetching remote data.</dd>
</dl>
</li>
</ul>
<a id="&lt;init&gt;(android.content.Context,java.lang.String,int,int,boolean)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>DefaultDataSource</h4>
<pre>public&nbsp;DefaultDataSource&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
@Nullable
<a href="https://developer.android.com/reference/java/lang/String.html" title="class or interface in java.lang" class="externalLink" target="_top">String</a>&nbsp;userAgent,
int&nbsp;connectTimeoutMillis,
int&nbsp;readTimeoutMillis,
boolean&nbsp;allowCrossProtocolRedirects)</pre>
<div class="block">Constructs a new instance, optionally configured to follow cross-protocol redirects.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - A context.</dd>
<dd><code>userAgent</code> - The user agent that will be used when requesting remote data, or <code>null</code>
to use the default user agent of the underlying platform.</dd>
<dd><code>connectTimeoutMillis</code> - The connection timeout that should be used when requesting remote
data, in milliseconds. A timeout of zero is interpreted as an infinite timeout.</dd>
<dd><code>readTimeoutMillis</code> - The read timeout that should be used when requesting remote data, in
milliseconds. A timeout of zero is interpreted as an infinite timeout.</dd>
<dd><code>allowCrossProtocolRedirects</code> - Whether cross-protocol redirects (i.e. redirects from HTTP
to HTTPS and vice versa) are enabled when fetching remote data.</dd>
</dl>
</li>
</ul>
<a id="&lt;init&gt;(android.content.Context,com.google.android.exoplayer2.upstream.DataSource)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DefaultDataSource</h4>
<pre>public&nbsp;DefaultDataSource&#8203;(<a href="https://developer.android.com/reference/android/content/Context.html" title="class or interface in android.content" class="externalLink" target="_top">Context</a>&nbsp;context,
<a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a>&nbsp;baseDataSource)</pre>
<div class="block">Constructs a new instance that delegates to a provided <a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream"><code>DataSource</code></a> for URI schemes other
than file, asset and content.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>context</code> - A context.</dd>
<dd><code>baseDataSource</code> - A <a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream"><code>DataSource</code></a> to use for URI schemes other than file, asset and
content. This <a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream"><code>DataSource</code></a> should normally support at least http(s).</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
<!-- ============ METHOD DETAIL ========== -->
<section role="region">
<ul class="blockList">
<li class="blockList"><a id="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a id="addTransferListener(com.google.android.exoplayer2.upstream.TransferListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addTransferListener</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;addTransferListener&#8203;(<a href="TransferListener.html" title="interface in com.google.android.exoplayer2.upstream">TransferListener</a>&nbsp;transferListener)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="DataSource.html#addTransferListener(com.google.android.exoplayer2.upstream.TransferListener)">DataSource</a></code></span></div>
<div class="block">Adds a <a href="TransferListener.html" title="interface in com.google.android.exoplayer2.upstream"><code>TransferListener</code></a> to listen to data transfers. This method is not thread-safe.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="DataSource.html#addTransferListener(com.google.android.exoplayer2.upstream.TransferListener)">addTransferListener</a></code>&nbsp;in interface&nbsp;<code><a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>transferListener</code> - A <a href="TransferListener.html" title="interface in com.google.android.exoplayer2.upstream"><code>TransferListener</code></a>.</dd>
</dl>
</li>
</ul>
<a id="open(com.google.android.exoplayer2.upstream.DataSpec)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>open</h4>
<pre class="methodSignature">public&nbsp;long&nbsp;open&#8203;(<a href="DataSpec.html" title="class in com.google.android.exoplayer2.upstream">DataSpec</a>&nbsp;dataSpec)
throws <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)">DataSource</a></code></span></div>
<div class="block">Opens the source to read the specified data. If an <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top"><code>IOException</code></a> is thrown, callers must
still call <a href="DataSource.html#close()"><code>DataSource.close()</code></a> to ensure that any partial effects of the invocation are cleaned
up.
<p>The following edge case behaviors apply:
<ul>
<li>If the <a href="DataSpec.html#position"><code>requested position</code></a> is within the resource, but the
<a href="DataSpec.html#length"><code>requested length</code></a> extends beyond the end of the resource, then
<a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)</code></a> will succeed and data from the requested position to the end of the
resource will be made available through <a href="DataReader.html#read(byte%5B%5D,int,int)"><code>DataReader.read(byte[], int, int)</code></a>.
<li>If the <a href="DataSpec.html#position"><code>requested position</code></a> is equal to the length of the
resource, then <a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)</code></a> will succeed, and <a href="DataReader.html#read(byte%5B%5D,int,int)"><code>DataReader.read(byte[], int, int)</code></a> will immediately return
<a href="../C.html#RESULT_END_OF_INPUT"><code>C.RESULT_END_OF_INPUT</code></a>.
<li>If the <a href="DataSpec.html#position"><code>requested position</code></a> is greater than the length of the
resource, then <a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)</code></a> will throw an <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink"><code>IOException</code></a> for which <a href="DataSourceException.html#isCausedByPositionOutOfRange(java.io.IOException)" target="_top"><code>DataSourceException.isCausedByPositionOutOfRange(java.io.IOException)</code></a> will be <code>true</code>.
</ul></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)">open</a></code>&nbsp;in interface&nbsp;<code><a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>dataSpec</code> - Defines the data to be read.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The number of bytes that can be read from the opened source. For unbounded requests
(i.e., requests where <a href="DataSpec.html#length"><code>DataSpec.length</code></a> equals <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a>) this value is
the resolved length of the request, or <a href="../C.html#LENGTH_UNSET"><code>C.LENGTH_UNSET</code></a> if the length is still
unresolved. For all other requests, the value returned will be equal to the request's
<a href="DataSpec.html#length"><code>DataSpec.length</code></a>.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink">IOException</a></code> - If an error occurs opening the source. <a href="DataSourceException.html" title="class in com.google.android.exoplayer2.upstream" target="_top"><code>DataSourceException</code></a> can be
thrown or used as a cause of the thrown exception to specify the reason of the error.</dd>
</dl>
</li>
</ul>
<a id="read(byte[],int,int)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>read</h4>
<pre class="methodSignature">public&nbsp;int&nbsp;read&#8203;(byte[]&nbsp;buffer,
int&nbsp;offset,
int&nbsp;readLength)
throws <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="DataReader.html#read(byte%5B%5D,int,int)">DataReader</a></code></span></div>
<div class="block">Reads up to <code>length</code> bytes of data from the input.
<p>If <code>readLength</code> is zero then 0 is returned. Otherwise, if no data is available because
the end of the opened range has been reached, then <a href="../C.html#RESULT_END_OF_INPUT"><code>C.RESULT_END_OF_INPUT</code></a> is returned.
Otherwise, the call will block until at least one byte of data has been read and the number of
bytes read is returned.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="DataReader.html#read(byte%5B%5D,int,int)">read</a></code>&nbsp;in interface&nbsp;<code><a href="DataReader.html" title="interface in com.google.android.exoplayer2.upstream">DataReader</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>buffer</code> - A target array into which data should be written.</dd>
<dd><code>offset</code> - The offset into the target array at which to write.</dd>
<dd><code>readLength</code> - The maximum number of bytes to read from the input.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The number of bytes read, or <a href="../C.html#RESULT_END_OF_INPUT"><code>C.RESULT_END_OF_INPUT</code></a> if the input has ended. This
may be less than <code>length</code> because the end of the input (or available data) was
reached, the method was interrupted, or the operation was aborted early for another reason.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></code> - If an error occurs reading from the input.</dd>
</dl>
</li>
</ul>
<a id="getUri()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUri</h4>
<pre class="methodSignature">@Nullable
public&nbsp;<a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink" target="_top">Uri</a>&nbsp;getUri()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="DataSource.html#getUri()">DataSource</a></code></span></div>
<div class="block">When the source is open, returns the <a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink" target="_top"><code>Uri</code></a> from which data is being read. The returned
<a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink"><code>Uri</code></a> will be identical to the one passed <a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(DataSpec)</code></a> in the <a href="DataSpec.html" title="class in com.google.android.exoplayer2.upstream" target="_top"><code>DataSpec</code></a>
unless redirection has occurred. If redirection has occurred, the <a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink" target="_top"><code>Uri</code></a> after redirection
is returned.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="DataSource.html#getUri()">getUri</a></code>&nbsp;in interface&nbsp;<code><a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The <a href="https://developer.android.com/reference/android/net/Uri.html" title="class or interface in android.net" class="externalLink" target="_top"><code>Uri</code></a> from which data is being read, or null if the source is not open.</dd>
</dl>
</li>
</ul>
<a id="getResponseHeaders()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getResponseHeaders</h4>
<pre class="methodSignature">public&nbsp;<a href="https://developer.android.com/reference/java/util/Map.html" title="class or interface in java.util" class="externalLink">Map</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink">String</a>,&#8203;<a href="https://developer.android.com/reference/java/util/List.html?is-external=true" title="class or interface in java.util" class="externalLink">List</a>&lt;<a href="https://developer.android.com/reference/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_top">String</a>&gt;&gt;&nbsp;getResponseHeaders()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="DataSource.html#getResponseHeaders()">DataSource</a></code></span></div>
<div class="block">When the source is open, returns the response headers associated with the last <a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)</code></a>
call. Otherwise, returns an empty map.
<p>Key look-up in the returned map is case-insensitive.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="DataSource.html#getResponseHeaders()">getResponseHeaders</a></code>&nbsp;in interface&nbsp;<code><a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></code></dd>
</dl>
</li>
</ul>
<a id="close()">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>close</h4>
<pre class="methodSignature">public&nbsp;void&nbsp;close()
throws <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface:&nbsp;<code><a href="DataSource.html#close()">DataSource</a></code></span></div>
<div class="block">Closes the source. This method must be called even if the corresponding call to <a href="DataSource.html#open(com.google.android.exoplayer2.upstream.DataSpec)"><code>DataSource.open(DataSpec)</code></a> threw an <a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top"><code>IOException</code></a>.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="DataSource.html#close()">close</a></code>&nbsp;in interface&nbsp;<code><a href="DataSource.html" title="interface in com.google.android.exoplayer2.upstream">DataSource</a></code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="https://developer.android.com/reference/java/io/IOException.html" title="class or interface in java.io" class="externalLink" target="_top">IOException</a></code> - If an error occurs closing the source.</dd>
</dl>
</li>
</ul>
</li>
</ul>
</section>
</li>
</ul>
</div>
</div>
</main>
<!-- ========= END OF CLASS DATA ========= -->
<footer role="contentinfo">
<nav role="navigation">
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a id="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a id="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../allclasses.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a id="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</nav>
</footer>
</body>
</html>