Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
3de81c6d
authored
Mar 05, 2021
by
olly
Committed by
Ian Baker
Mar 12, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
HttpDataSources: Remove unused protected methods
PiperOrigin-RevId: 361109018
parent
49c282d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
87 deletions
extensions/okhttp/src/main/java/com/google/android/exoplayer2/ext/okhttp/OkHttpDataSource.java
library/common/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java
extensions/okhttp/src/main/java/com/google/android/exoplayer2/ext/okhttp/OkHttpDataSource.java
View file @
3de81c6d
...
...
@@ -180,8 +180,6 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
@Nullable
private
Response
response
;
@Nullable
private
InputStream
responseByteStream
;
private
boolean
opened
;
private
long
bytesSkipped
;
private
long
bytesToRead
;
private
long
bytesRead
;
...
...
@@ -275,7 +273,6 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
public
long
open
(
DataSpec
dataSpec
)
throws
HttpDataSourceException
{
this
.
dataSpec
=
dataSpec
;
this
.
bytesRead
=
0
;
this
.
bytesSkipped
=
0
;
transferInitializing
(
dataSpec
);
Request
request
=
makeRequest
(
dataSpec
);
...
...
@@ -372,38 +369,6 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
}
}
/**
* Returns the number of bytes that were skipped during the most recent call to {@link
* #open(DataSpec)}.
*
* @return The number of bytes skipped.
*/
protected
final
long
bytesSkipped
()
{
return
bytesSkipped
;
}
/**
* Returns the number of bytes that have been read since the most recent call to
* {@link #open(DataSpec)}.
*
* @return The number of bytes read.
*/
protected
final
long
bytesRead
()
{
return
bytesRead
;
}
/**
* Returns the number of bytes that are still to be read for the current {@link DataSpec}.
* <p>
* If the total length of the data being read is known, then this length minus {@code bytesRead()}
* is returned. If the total length is unknown, {@link C#LENGTH_UNSET} is returned.
*
* @return The remaining length, or {@link C#LENGTH_UNSET}.
*/
protected
final
long
bytesRemaining
()
{
return
bytesToRead
==
C
.
LENGTH_UNSET
?
bytesToRead
:
bytesToRead
-
bytesRead
;
}
/** Establishes a connection. */
private
Request
makeRequest
(
DataSpec
dataSpec
)
throws
HttpDataSourceException
{
long
position
=
dataSpec
.
position
;
...
...
@@ -471,8 +436,8 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
return
true
;
}
byte
[]
skipBuffer
=
new
byte
[
4096
];
while
(
bytes
Skipped
!=
bytesToSkip
)
{
int
readLength
=
(
int
)
min
(
bytesToSkip
-
bytesSkipped
,
skipBuffer
.
length
);
while
(
bytes
ToSkip
>
0
)
{
int
readLength
=
(
int
)
min
(
bytesToSkip
,
skipBuffer
.
length
);
int
read
=
castNonNull
(
responseByteStream
).
read
(
skipBuffer
,
0
,
readLength
);
if
(
Thread
.
currentThread
().
isInterrupted
())
{
throw
new
InterruptedIOException
();
...
...
@@ -480,7 +445,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
if
(
read
==
-
1
)
{
return
false
;
}
bytes
Skipped
+
=
read
;
bytes
ToSkip
-
=
read
;
bytesTransferred
(
read
);
}
return
true
;
...
...
library/common/src/main/java/com/google/android/exoplayer2/upstream/DefaultHttpDataSource.java
View file @
3de81c6d
...
...
@@ -222,8 +222,6 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
@Nullable
private
InputStream
inputStream
;
private
boolean
opened
;
private
int
responseCode
;
private
long
bytesSkipped
;
private
long
bytesToRead
;
private
long
bytesRead
;
...
...
@@ -338,7 +336,6 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
public
long
open
(
DataSpec
dataSpec
)
throws
HttpDataSourceException
{
this
.
dataSpec
=
dataSpec
;
this
.
bytesRead
=
0
;
this
.
bytesSkipped
=
0
;
transferInitializing
(
dataSpec
);
try
{
...
...
@@ -455,7 +452,9 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
try
{
@Nullable
InputStream
inputStream
=
this
.
inputStream
;
if
(
inputStream
!=
null
)
{
maybeTerminateInputStream
(
connection
,
bytesRemaining
());
long
bytesRemaining
=
bytesToRead
==
C
.
LENGTH_UNSET
?
C
.
LENGTH_UNSET
:
bytesToRead
-
bytesRead
;
maybeTerminateInputStream
(
connection
,
bytesRemaining
);
try
{
inputStream
.
close
();
}
catch
(
IOException
e
)
{
...
...
@@ -474,48 +473,6 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
}
/**
* Returns the current connection, or null if the source is not currently opened.
*
* @return The current open connection, or null.
*/
@Nullable
protected
final
HttpURLConnection
getConnection
()
{
return
connection
;
}
/**
* Returns the number of bytes that were skipped during the most recent call to {@link
* #open(DataSpec)}.
*
* @return The number of bytes skipped.
*/
protected
final
long
bytesSkipped
()
{
return
bytesSkipped
;
}
/**
* Returns the number of bytes that have been read since the most recent call to
* {@link #open(DataSpec)}.
*
* @return The number of bytes read.
*/
protected
final
long
bytesRead
()
{
return
bytesRead
;
}
/**
* Returns the number of bytes that are still to be read for the current {@link DataSpec}.
* <p>
* If the total length of the data being read is known, then this length minus {@code bytesRead()}
* is returned. If the total length is unknown, {@link C#LENGTH_UNSET} is returned.
*
* @return The remaining length, or {@link C#LENGTH_UNSET}.
*/
protected
final
long
bytesRemaining
()
{
return
bytesToRead
==
C
.
LENGTH_UNSET
?
bytesToRead
:
bytesToRead
-
bytesRead
;
}
/**
* Establishes a connection, following redirects to do so where permitted.
*/
private
HttpURLConnection
makeConnection
(
DataSpec
dataSpec
)
throws
IOException
{
...
...
@@ -742,8 +699,8 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
return
true
;
}
byte
[]
skipBuffer
=
new
byte
[
4096
];
while
(
bytes
Skipped
!=
bytesToSkip
)
{
int
readLength
=
(
int
)
min
(
bytesToSkip
-
bytesSkipped
,
skipBuffer
.
length
);
while
(
bytes
ToSkip
>
0
)
{
int
readLength
=
(
int
)
min
(
bytesToSkip
,
skipBuffer
.
length
);
int
read
=
castNonNull
(
inputStream
).
read
(
skipBuffer
,
0
,
readLength
);
if
(
Thread
.
currentThread
().
isInterrupted
())
{
throw
new
InterruptedIOException
();
...
...
@@ -751,7 +708,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
if
(
read
==
-
1
)
{
return
false
;
}
bytes
Skipped
+
=
read
;
bytes
ToSkip
-
=
read
;
bytesTransferred
(
read
);
}
return
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment