From 1a68f3d3a481e9a668a3c0222d997f27cc220b55 Mon Sep 17 00:00:00 2001 From: olly Date: Thu, 11 Mar 2021 23:05:53 +0000 Subject: [PATCH] Document DataSource edge-case behaviors PiperOrigin-RevId: 362386100 --- .../exoplayer2/upstream/DataSource.java | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/upstream/DataSource.java b/library/common/src/main/java/com/google/android/exoplayer2/upstream/DataSource.java index bbc182d7af..c157002809 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/upstream/DataSource.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/upstream/DataSource.java @@ -45,17 +45,31 @@ public interface DataSource extends DataReader { void addTransferListener(TransferListener transferListener); /** - * Opens the source to read the specified data. - *

- * Note: If an {@link IOException} is thrown, callers must still call {@link #close()} to ensure - * that any partial effects of the invocation are cleaned up. + * Opens the source to read the specified data. If an {@link IOException} is thrown, callers must + * still call {@link #close()} to ensure that any partial effects of the invocation are cleaned + * up. + * + *

The following edge case behaviors apply: + * + *

* * @param dataSpec Defines the data to be read. * @throws IOException If an error occurs opening the source. {@link DataSourceException} can be * thrown or used as a cause of the thrown exception to specify the reason of the error. * @return The number of bytes that can be read from the opened source. For unbounded requests - * (i.e. requests where {@link DataSpec#length} equals {@link C#LENGTH_UNSET}) this value - * is the resolved length of the request, or {@link C#LENGTH_UNSET} if the length is still + * (i.e., requests where {@link DataSpec#length} equals {@link C#LENGTH_UNSET}) this value is + * the resolved length of the request, or {@link C#LENGTH_UNSET} if the length is still * unresolved. For all other requests, the value returned will be equal to the request's * {@link DataSpec#length}. */ @@ -82,10 +96,8 @@ public interface DataSource extends DataReader { } /** - * Closes the source. - *

- * Note: This method must be called even if the corresponding call to {@link #open(DataSpec)} - * threw an {@link IOException}. See {@link #open(DataSpec)} for more details. + * Closes the source. This method must be called even if the corresponding call to {@link + * #open(DataSpec)} threw an {@link IOException}. * * @throws IOException If an error occurs closing the source. */