Commit b2fc944a by Oliver Woodman

Remove getLoadedData API from ExoPlayer components.

This API wasn't particularly nice. Best to remove it whilst
hopefully no-one is using it. Leaving the ReadHead abstraction
in place, since it might well prove useful in the future.
parent c19faa63
...@@ -135,18 +135,6 @@ public abstract class Chunk implements Loadable { ...@@ -135,18 +135,6 @@ public abstract class Chunk implements Loadable {
} }
/** /**
* Returns a byte array containing the loaded data. If the chunk is partially loaded, this
* method returns the data that has been loaded so far. If nothing has been loaded, null is
* returned.
*
* @return The loaded data or null.
*/
public final byte[] getLoadedData() {
Assertions.checkState(dataSourceStream != null);
return dataSourceStream.getLoadedData();
}
/**
* Invoked by {@link #consume()}. Implementations may override this method if they wish to * Invoked by {@link #consume()}. Implementations may override this method if they wish to
* consume the loaded data at this point. * consume the loaded data at this point.
* <p> * <p>
......
...@@ -64,10 +64,8 @@ public class SingleSampleMediaChunk extends MediaChunk { ...@@ -64,10 +64,8 @@ public class SingleSampleMediaChunk extends MediaChunk {
* @param nextChunkIndex The index of the next chunk, or -1 if this is the last chunk. * @param nextChunkIndex The index of the next chunk, or -1 if this is the last chunk.
* @param sampleFormat The format of the media contained by the chunk. * @param sampleFormat The format of the media contained by the chunk.
* @param headerData Custom header data for the sample. May be null. If set, the header data is * @param headerData Custom header data for the sample. May be null. If set, the header data is
* prepended to the sample data returned when {@link #read(SampleHolder)} is called. It is * prepended to the sample data returned when {@link #read(SampleHolder)} is called. It is not
* however not considered part of the loaded data, and so is not prepended to the data * reflected in the values returned by {@link #bytesLoaded()} and {@link #getLength()}.
* returned by {@link #getLoadedData()}. It is also not reflected in the values returned by
* {@link #bytesLoaded()} and {@link #getLength()}.
*/ */
public SingleSampleMediaChunk(DataSource dataSource, DataSpec dataSpec, Format format, public SingleSampleMediaChunk(DataSource dataSource, DataSpec dataSpec, Format format,
int trigger, long startTimeUs, long endTimeUs, int nextChunkIndex, MediaFormat sampleFormat, int trigger, long startTimeUs, long endTimeUs, int nextChunkIndex, MediaFormat sampleFormat,
......
...@@ -119,26 +119,6 @@ public final class DataSourceStream implements Loadable, NonBlockingInputStream ...@@ -119,26 +119,6 @@ public final class DataSourceStream implements Loadable, NonBlockingInputStream
return resolvedLength != C.LENGTH_UNBOUNDED && loadPosition == resolvedLength; return resolvedLength != C.LENGTH_UNBOUNDED && loadPosition == resolvedLength;
} }
/**
* Returns a byte array containing the loaded data. If the data is partially loaded, this method
* returns the portion of the data that has been loaded so far. If nothing has been loaded, null
* is returned. This method does not use or update the current read position.
* <p>
* Note: The read methods provide a more efficient way of consuming the loaded data. Use this
* method only when a freshly allocated byte[] containing all of the loaded data is required.
*
* @return The loaded data, or null.
*/
public final byte[] getLoadedData() {
if (loadPosition == 0) {
return null;
}
byte[] rawData = new byte[(int) loadPosition];
read(null, rawData, 0, new ReadHead(), rawData.length);
return rawData;
}
// {@link NonBlockingInputStream} implementation. // {@link NonBlockingInputStream} implementation.
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment