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.
This commit is contained in:
Oliver Woodman 2014-09-19 18:26:04 +01:00
parent c19faa63cd
commit b2fc944af1
3 changed files with 2 additions and 36 deletions

View File

@ -134,18 +134,6 @@ public abstract class Chunk implements Loadable {
consumeStream(dataSourceStream); consumeStream(dataSourceStream);
} }
/**
* 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.

View File

@ -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,

View File

@ -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