Make classes/methods final to prevent uncontrolled extension.

This commit is contained in:
Oliver Woodman 2015-08-03 15:17:41 +01:00
parent 6b775efd4d
commit 574e554e01
56 changed files with 79 additions and 79 deletions

View File

@ -25,10 +25,10 @@ public class TimeRangeTest extends TestCase {
public void testEquals() { public void testEquals() {
TimeRange timeRange1 = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, 30000000); TimeRange timeRange1 = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, 30000000);
assertTrue(timeRange1.equals(timeRange1)); assertTrue(timeRange1.equals(timeRange1));
TimeRange timeRange2 = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, 30000000); TimeRange timeRange2 = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, 30000000);
assertTrue(timeRange1.equals(timeRange2)); assertTrue(timeRange1.equals(timeRange2));
TimeRange timeRange3 = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, 60000000); TimeRange timeRange3 = new TimeRange(TimeRange.TYPE_SNAPSHOT, 0, 60000000);
assertFalse(timeRange1.equals(timeRange3)); assertFalse(timeRange1.equals(timeRange3));
} }

View File

@ -82,7 +82,6 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
new Format("3", "video/mp4", WIDE_WIDTH, 50, -1, -1, -1, 1000); new Format("3", "video/mp4", WIDE_WIDTH, 50, -1, -1, -1, 1000);
@Mock private DataSource mockDataSource; @Mock private DataSource mockDataSource;
@Mock private ManifestFetcher<MediaPresentationDescription> mockManifestFetcher;
@Override @Override
public void setUp() throws Exception { public void setUp() throws Exception {

View File

@ -20,7 +20,7 @@ import java.io.IOException;
/** /**
* Thrown when a live playback falls behind the available media window. * Thrown when a live playback falls behind the available media window.
*/ */
public class BehindLiveWindowException extends IOException { public final class BehindLiveWindowException extends IOException {
public BehindLiveWindowException() { public BehindLiveWindowException() {
super(); super();

View File

@ -23,7 +23,7 @@ import android.media.MediaExtractor;
/** /**
* Compatibility wrapper around {@link android.media.MediaCodec.CryptoInfo}. * Compatibility wrapper around {@link android.media.MediaCodec.CryptoInfo}.
*/ */
public class CryptoInfo { public final class CryptoInfo {
/** /**
* @see android.media.MediaCodec.CryptoInfo#iv * @see android.media.MediaCodec.CryptoInfo#iv

View File

@ -39,7 +39,7 @@ import java.util.List;
* itself as a task with priority {@link NetworkLock#STREAMING_PRIORITY} during loading periods, * itself as a task with priority {@link NetworkLock#STREAMING_PRIORITY} during loading periods,
* and unregistering itself during draining periods. * and unregistering itself during draining periods.
*/ */
public class DefaultLoadControl implements LoadControl { public final class DefaultLoadControl implements LoadControl {
/** /**
* Interface definition for a callback to be notified of {@link DefaultLoadControl} events. * Interface definition for a callback to be notified of {@link DefaultLoadControl} events.

View File

@ -22,7 +22,7 @@ package com.google.android.exoplayer;
* to request that it should be ignored. {@link IllegalStateException} is thrown from all methods * to request that it should be ignored. {@link IllegalStateException} is thrown from all methods
* that are documented to indicate that they should not be invoked unless the renderer is prepared. * that are documented to indicate that they should not be invoked unless the renderer is prepared.
*/ */
public class DummyTrackRenderer extends TrackRenderer { public final class DummyTrackRenderer extends TrackRenderer {
@Override @Override
protected int doPrepare(long positionUs) { protected int doPrepare(long positionUs) {

View File

@ -18,10 +18,7 @@ package com.google.android.exoplayer;
/** /**
* Information about the ExoPlayer library. * Information about the ExoPlayer library.
*/ */
// TODO: This file should be automatically generated by the build system. public final class ExoPlayerLibraryInfo {
public class ExoPlayerLibraryInfo {
private ExoPlayerLibraryInfo() {}
/** /**
* The version of the library, expressed as a string. * The version of the library, expressed as a string.
@ -48,4 +45,6 @@ public class ExoPlayerLibraryInfo {
*/ */
public static final boolean TRACE_ENABLED = true; public static final boolean TRACE_ENABLED = true;
private ExoPlayerLibraryInfo() {}
} }

View File

@ -34,7 +34,7 @@ import java.util.HashMap;
* A utility class for querying the available codecs. * A utility class for querying the available codecs.
*/ */
@TargetApi(16) @TargetApi(16)
public class MediaCodecUtil { public final class MediaCodecUtil {
/** /**
* Thrown when an error occurs querying the device for its underlying media capabilities. * Thrown when an error occurs querying the device for its underlying media capabilities.
@ -54,6 +54,8 @@ public class MediaCodecUtil {
private static final HashMap<CodecKey, Pair<String, CodecCapabilities>> codecs = new HashMap<>(); private static final HashMap<CodecKey, Pair<String, CodecCapabilities>> codecs = new HashMap<>();
private MediaCodecUtil() {}
/** /**
* Get information about the decoder that will be used for a given mime type. * Get information about the decoder that will be used for a given mime type.
* *

View File

@ -29,7 +29,7 @@ import java.util.List;
/** /**
* Defines the format of an elementary media stream. * Defines the format of an elementary media stream.
*/ */
public class MediaFormat { public final class MediaFormat {
private static final String KEY_PIXEL_WIDTH_HEIGHT_RATIO = private static final String KEY_PIXEL_WIDTH_HEIGHT_RATIO =
"com.google.android.videos.pixelWidthHeightRatio"; "com.google.android.videos.pixelWidthHeightRatio";

View File

@ -25,7 +25,7 @@ import android.view.Choreographer.FrameCallback;
* Makes a best effort to adjust frame release timestamps for a smoother visual result. * Makes a best effort to adjust frame release timestamps for a smoother visual result.
*/ */
@TargetApi(16) @TargetApi(16)
public class SmoothFrameReleaseTimeHelper implements FrameReleaseTimeHelper, FrameCallback { public final class SmoothFrameReleaseTimeHelper implements FrameReleaseTimeHelper, FrameCallback {
private static final long CHOREOGRAPHER_SAMPLE_DELAY_MILLIS = 500; private static final long CHOREOGRAPHER_SAMPLE_DELAY_MILLIS = 500;
private static final long MAX_ALLOWED_DRIFT_NS = 20000000; private static final long MAX_ALLOWED_DRIFT_NS = 20000000;

View File

@ -21,7 +21,7 @@ import android.os.SystemClock;
* A standalone {@link MediaClock}. The clock can be started, stopped and its time can be set and * A standalone {@link MediaClock}. The clock can be started, stopped and its time can be set and
* retrieved. When started, this clock is based on {@link SystemClock#elapsedRealtime()}. * retrieved. When started, this clock is based on {@link SystemClock#elapsedRealtime()}.
*/ */
/* package */ class StandaloneMediaClock implements MediaClock { /* package */ final class StandaloneMediaClock implements MediaClock {
private boolean started; private boolean started;

View File

@ -74,68 +74,69 @@ public class ContainerMediaChunk extends BaseMediaChunk implements SingleTrackOu
} }
@Override @Override
public long bytesLoaded() { public final long bytesLoaded() {
return bytesLoaded; return bytesLoaded;
} }
@Override @Override
public MediaFormat getMediaFormat() { public final MediaFormat getMediaFormat() {
return mediaFormat; return mediaFormat;
} }
@Override @Override
public DrmInitData getDrmInitData() { public final DrmInitData getDrmInitData() {
return drmInitData; return drmInitData;
} }
// SingleTrackOutput implementation. // SingleTrackOutput implementation.
@Override @Override
public void seekMap(SeekMap seekMap) { public final void seekMap(SeekMap seekMap) {
// Do nothing. // Do nothing.
} }
@Override @Override
public void drmInitData(DrmInitData drmInitData) { public final void drmInitData(DrmInitData drmInitData) {
this.drmInitData = drmInitData; this.drmInitData = drmInitData;
} }
@Override @Override
public void format(MediaFormat mediaFormat) { public final void format(MediaFormat mediaFormat) {
this.mediaFormat = mediaFormat; this.mediaFormat = mediaFormat;
} }
@Override @Override
public int sampleData(ExtractorInput input, int length, boolean allowEndOfInput) public final int sampleData(ExtractorInput input, int length, boolean allowEndOfInput)
throws IOException, InterruptedException { throws IOException, InterruptedException {
return getOutput().sampleData(input, length, allowEndOfInput); return getOutput().sampleData(input, length, allowEndOfInput);
} }
@Override @Override
public void sampleData(ParsableByteArray data, int length) { public final void sampleData(ParsableByteArray data, int length) {
getOutput().sampleData(data, length); getOutput().sampleData(data, length);
} }
@Override @Override
public void sampleMetadata(long timeUs, int flags, int size, int offset, byte[] encryptionKey) { public final void sampleMetadata(long timeUs, int flags, int size, int offset,
byte[] encryptionKey) {
getOutput().sampleMetadata(timeUs + sampleOffsetUs, flags, size, offset, encryptionKey); getOutput().sampleMetadata(timeUs + sampleOffsetUs, flags, size, offset, encryptionKey);
} }
// Loadable implementation. // Loadable implementation.
@Override @Override
public void cancelLoad() { public final void cancelLoad() {
loadCanceled = true; loadCanceled = true;
} }
@Override @Override
public boolean isLoadCanceled() { public final boolean isLoadCanceled() {
return loadCanceled; return loadCanceled;
} }
@SuppressWarnings("NonAtomicVolatileUpdate") @SuppressWarnings("NonAtomicVolatileUpdate")
@Override @Override
public void load() throws IOException, InterruptedException { public final void load() throws IOException, InterruptedException {
DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded); DataSpec loadDataSpec = Util.getRemainderDataSpec(dataSpec, bytesLoaded);
try { try {
// Create and open the input. // Create and open the input.

View File

@ -28,7 +28,7 @@ import java.util.List;
* A {@link ChunkSource} providing the ability to switch between multiple other {@link ChunkSource} * A {@link ChunkSource} providing the ability to switch between multiple other {@link ChunkSource}
* instances. * instances.
*/ */
public class MultiTrackChunkSource implements ChunkSource, ExoPlayerComponent { public final class MultiTrackChunkSource implements ChunkSource, ExoPlayerComponent {
/** /**
* A message to indicate a source selection. Source selection can only be performed when the * A message to indicate a source selection. Source selection can only be performed when the

View File

@ -29,7 +29,7 @@ import java.util.List;
* An example use case for this implementation is to act as the source for loading out-of-band * An example use case for this implementation is to act as the source for loading out-of-band
* subtitles, where subtitles for the entire video are delivered as a single file. * subtitles, where subtitles for the entire video are delivered as a single file.
*/ */
public class SingleSampleChunkSource implements ChunkSource { public final class SingleSampleChunkSource implements ChunkSource {
private final DataSource dataSource; private final DataSource dataSource;
private final DataSpec dataSpec; private final DataSpec dataSpec;

View File

@ -22,7 +22,7 @@ import com.google.android.exoplayer.extractor.ChunkIndex;
* An implementation of {@link DashSegmentIndex} that wraps a {@link ChunkIndex} parsed from a * An implementation of {@link DashSegmentIndex} that wraps a {@link ChunkIndex} parsed from a
* media stream. * media stream.
*/ */
public class DashWrappingSegmentIndex implements DashSegmentIndex { /* package */ final class DashWrappingSegmentIndex implements DashSegmentIndex {
private final ChunkIndex chunkIndex; private final ChunkIndex chunkIndex;
private final String uri; private final String uri;

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package com.google.android.exoplayer.dash; package com.google.android.exoplayer.dash.mpd;
import com.google.android.exoplayer.dash.mpd.RangedUri; import com.google.android.exoplayer.dash.DashSegmentIndex;
/** /**
* A {@link DashSegmentIndex} that defines a single segment. * A {@link DashSegmentIndex} that defines a single segment.
*/ */
public class DashSingleSegmentIndex implements DashSegmentIndex { /* package */ final class DashSingleSegmentIndex implements DashSegmentIndex {
private final long startTimeUs; private final long startTimeUs;
private final long durationUs; private final long durationUs;

View File

@ -18,7 +18,6 @@ package com.google.android.exoplayer.dash.mpd;
import com.google.android.exoplayer.chunk.Format; import com.google.android.exoplayer.chunk.Format;
import com.google.android.exoplayer.chunk.FormatWrapper; import com.google.android.exoplayer.chunk.FormatWrapper;
import com.google.android.exoplayer.dash.DashSegmentIndex; import com.google.android.exoplayer.dash.DashSegmentIndex;
import com.google.android.exoplayer.dash.DashSingleSegmentIndex;
import com.google.android.exoplayer.dash.mpd.SegmentBase.MultiSegmentBase; import com.google.android.exoplayer.dash.mpd.SegmentBase.MultiSegmentBase;
import com.google.android.exoplayer.dash.mpd.SegmentBase.SingleSegmentBase; import com.google.android.exoplayer.dash.mpd.SegmentBase.SingleSegmentBase;

View File

@ -18,7 +18,7 @@ package com.google.android.exoplayer.dash.mpd;
/** /**
* Represents a UTCTiming element. * Represents a UTCTiming element.
*/ */
public class UtcTimingElement { public final class UtcTimingElement {
public final String schemeIdUri; public final String schemeIdUri;
public final String value; public final String value;

View File

@ -38,7 +38,7 @@ import java.util.concurrent.CancellationException;
/** /**
* Resolves a {@link UtcTimingElement}. * Resolves a {@link UtcTimingElement}.
*/ */
public class UtcTimingElementResolver implements Loader.Callback { public final class UtcTimingElementResolver implements Loader.Callback {
/** /**
* Callback for timing element resolution. * Callback for timing element resolution.

View File

@ -67,8 +67,8 @@ import java.util.List;
* constructor. When reading a new stream, the first {@link Extractor} that returns {@code true} * constructor. When reading a new stream, the first {@link Extractor} that returns {@code true}
* from {@link Extractor#sniff(ExtractorInput)} will be used. * from {@link Extractor#sniff(ExtractorInput)} will be used.
*/ */
public class ExtractorSampleSource implements SampleSource, SampleSourceReader, ExtractorOutput, public final class ExtractorSampleSource implements SampleSource, SampleSourceReader,
Loader.Callback { ExtractorOutput, Loader.Callback {
/** /**
* Thrown if the input format could not recognized. * Thrown if the input format could not recognized.

View File

@ -29,7 +29,7 @@ import java.io.IOException;
* Facilitates the extraction of AAC samples from elementary audio files formatted as AAC with ADTS * Facilitates the extraction of AAC samples from elementary audio files formatted as AAC with ADTS
* headers. * headers.
*/ */
public class AdtsExtractor implements Extractor { public final class AdtsExtractor implements Extractor {
private static final int MAX_PACKET_SIZE = 200; private static final int MAX_PACKET_SIZE = 200;

View File

@ -30,7 +30,7 @@ import java.util.Collections;
/** /**
* Parses a continuous ADTS byte stream and extracts individual frames. * Parses a continuous ADTS byte stream and extracts individual frames.
*/ */
/* package */ class AdtsReader extends ElementaryStreamReader { /* package */ final class AdtsReader extends ElementaryStreamReader {
private static final int STATE_FINDING_SYNC = 0; private static final int STATE_FINDING_SYNC = 0;
private static final int STATE_READING_HEADER = 1; private static final int STATE_READING_HEADER = 1;

View File

@ -32,7 +32,7 @@ import java.util.List;
/** /**
* Parses a continuous H264 byte stream and extracts individual frames. * Parses a continuous H264 byte stream and extracts individual frames.
*/ */
/* package */ class H264Reader extends ElementaryStreamReader { /* package */ final class H264Reader extends ElementaryStreamReader {
private static final String TAG = "H264Reader"; private static final String TAG = "H264Reader";

View File

@ -30,7 +30,7 @@ import java.util.Collections;
/** /**
* Parses a continuous H.265 byte stream and extracts individual frames. * Parses a continuous H.265 byte stream and extracts individual frames.
*/ */
/* package */ class H265Reader extends ElementaryStreamReader { /* package */ final class H265Reader extends ElementaryStreamReader {
private static final String TAG = "H265Reader"; private static final String TAG = "H265Reader";

View File

@ -24,7 +24,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
/** /**
* Parses ID3 data and extracts individual text information frames. * Parses ID3 data and extracts individual text information frames.
*/ */
/* package */ class Id3Reader extends ElementaryStreamReader { /* package */ final class Id3Reader extends ElementaryStreamReader {
// State that should be reset on seek. // State that should be reset on seek.
private boolean writingSample; private boolean writingSample;

View File

@ -24,7 +24,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
/** /**
* Parses a continuous MPEG Audio byte stream and extracts individual frames. * Parses a continuous MPEG Audio byte stream and extracts individual frames.
*/ */
/* package */ class MpegAudioReader extends ElementaryStreamReader { /* package */ final class MpegAudioReader extends ElementaryStreamReader {
private static final int STATE_FINDING_HEADER = 0; private static final int STATE_FINDING_HEADER = 0;
private static final int STATE_READING_HEADER = 1; private static final int STATE_READING_HEADER = 1;

View File

@ -28,7 +28,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
* TODO: Technically, we shouldn't allow a sample to be read from the queue until we're sure that * TODO: Technically, we shouldn't allow a sample to be read from the queue until we're sure that
* a sample with an earlier timestamp won't be added to it. * a sample with an earlier timestamp won't be added to it.
*/ */
/* package */ class SeiReader extends ElementaryStreamReader { /* package */ final class SeiReader extends ElementaryStreamReader {
public SeiReader(TrackOutput output) { public SeiReader(TrackOutput output) {
super(output); super(output);

View File

@ -8,7 +8,7 @@ import java.io.IOException;
/** /**
* Reads EBML variable-length integers (varints) from an {@link ExtractorInput}. * Reads EBML variable-length integers (varints) from an {@link ExtractorInput}.
*/ */
/* package */ class VarintReader { /* package */ final class VarintReader {
private static final int STATE_BEGIN_READING = 0; private static final int STATE_BEGIN_READING = 0;
private static final int STATE_READ_CONTENTS = 1; private static final int STATE_READ_CONTENTS = 1;

View File

@ -40,7 +40,7 @@ import java.util.LinkedList;
/** /**
* A {@link SampleSource} for HLS streams. * A {@link SampleSource} for HLS streams.
*/ */
public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader.Callback { public final class HlsSampleSource implements SampleSource, SampleSourceReader, Loader.Callback {
/** /**
* Interface definition for a callback to be notified of {@link HlsSampleSource} events. * Interface definition for a callback to be notified of {@link HlsSampleSource} events.
@ -561,7 +561,7 @@ public class HlsSampleSource implements SampleSource, SampleSourceReader, Loader
return Math.min((errorCount - 1) * 1000, 5000); return Math.min((errorCount - 1) * 1000, 5000);
} }
protected final int usToMs(long timeUs) { /* package */ int usToMs(long timeUs) {
return (int) (timeUs / 1000); return (int) (timeUs / 1000);
} }

View File

@ -19,7 +19,7 @@ package com.google.android.exoplayer.metadata;
* A metadata that contains parsed ID3 GEOB (General Encapsulated Object) frame data associated * A metadata that contains parsed ID3 GEOB (General Encapsulated Object) frame data associated
* with time indices. * with time indices.
*/ */
public class GeobMetadata { public final class GeobMetadata {
public static final String TYPE = "GEOB"; public static final String TYPE = "GEOB";

View File

@ -28,7 +28,7 @@ import java.util.Map;
/** /**
* Extracts individual TXXX text frames from raw ID3 data. * Extracts individual TXXX text frames from raw ID3 data.
*/ */
public class Id3Parser implements MetadataParser<Map<String, Object>> { public final class Id3Parser implements MetadataParser<Map<String, Object>> {
private static final int ID3_TEXT_ENCODING_ISO_8859_1 = 0; private static final int ID3_TEXT_ENCODING_ISO_8859_1 = 0;
private static final int ID3_TEXT_ENCODING_UTF_16 = 1; private static final int ID3_TEXT_ENCODING_UTF_16 = 1;

View File

@ -35,7 +35,7 @@ import java.io.IOException;
* *
* @param <T> The type of the metadata. * @param <T> The type of the metadata.
*/ */
public class MetadataTrackRenderer<T> extends TrackRenderer implements Callback { public final class MetadataTrackRenderer<T> extends TrackRenderer implements Callback {
/** /**
* An interface for components that process metadata. * An interface for components that process metadata.

View File

@ -19,7 +19,7 @@ package com.google.android.exoplayer.metadata;
* A metadata that contains parsed ID3 PRIV (Private) frame data associated * A metadata that contains parsed ID3 PRIV (Private) frame data associated
* with time indices. * with time indices.
*/ */
public class PrivMetadata { public final class PrivMetadata {
public static final String TYPE = "PRIV"; public static final String TYPE = "PRIV";

View File

@ -19,7 +19,7 @@ package com.google.android.exoplayer.metadata;
* A metadata that contains parsed ID3 TXXX (User defined text information) frame data associated * A metadata that contains parsed ID3 TXXX (User defined text information) frame data associated
* with time indices. * with time indices.
*/ */
public class TxxxMetadata { public final class TxxxMetadata {
public static final String TYPE = "TXXX"; public static final String TYPE = "TXXX";

View File

@ -31,7 +31,7 @@ import java.io.InputStream;
* Wraps a {@link SubtitleParser}, exposing an interface similar to {@link MediaCodec} for * Wraps a {@link SubtitleParser}, exposing an interface similar to {@link MediaCodec} for
* asynchronous parsing of subtitles. * asynchronous parsing of subtitles.
*/ */
public class SubtitleParserHelper implements Handler.Callback { public final class SubtitleParserHelper implements Handler.Callback {
private final SubtitleParser parser; private final SubtitleParser parser;

View File

@ -58,7 +58,7 @@ import java.util.List;
* {@link SubtitleParser#canParse(String)} will be used. * {@link SubtitleParser#canParse(String)} will be used.
*/ */
@TargetApi(16) @TargetApi(16)
public class TextTrackRenderer extends TrackRenderer implements Callback { public final class TextTrackRenderer extends TrackRenderer implements Callback {
private static final int MSG_UPDATE_OVERLAY = 0; private static final int MSG_UPDATE_OVERLAY = 0;

View File

@ -26,7 +26,7 @@ import java.util.ArrayList;
* Facilitates the extraction and parsing of EIA-608 (a.k.a. "line 21 captions" and "CEA-608") * Facilitates the extraction and parsing of EIA-608 (a.k.a. "line 21 captions" and "CEA-608")
* Closed Captions from the SEI data block from H.264. * Closed Captions from the SEI data block from H.264.
*/ */
public class Eia608Parser { public final class Eia608Parser {
private static final int PAYLOAD_TYPE_CC = 4; private static final int PAYLOAD_TYPE_CC = 4;
private static final int COUNTRY_CODE = 0xB5; private static final int COUNTRY_CODE = 0xB5;

View File

@ -39,7 +39,7 @@ import java.util.TreeSet;
/** /**
* A {@link TrackRenderer} for EIA-608 closed captions in a media stream. * A {@link TrackRenderer} for EIA-608 closed captions in a media stream.
*/ */
public class Eia608TrackRenderer extends TrackRenderer implements Callback { public final class Eia608TrackRenderer extends TrackRenderer implements Callback {
private static final int MSG_INVOKE_RENDERER = 0; private static final int MSG_INVOKE_RENDERER = 0;

View File

@ -54,7 +54,7 @@ import java.util.regex.Pattern;
* </p> * </p>
* @see <a href="http://www.w3.org/TR/ttaf1-dfxp/">TTML specification</a> * @see <a href="http://www.w3.org/TR/ttaf1-dfxp/">TTML specification</a>
*/ */
public class TtmlParser implements SubtitleParser { public final class TtmlParser implements SubtitleParser {
private static final String TAG = "TtmlParser"; private static final String TAG = "TtmlParser";

View File

@ -91,7 +91,7 @@ public class WebvttParser implements SubtitleParser {
} }
@Override @Override
public WebvttSubtitle parse(InputStream inputStream, String inputEncoding, long startTimeUs) public final WebvttSubtitle parse(InputStream inputStream, String inputEncoding, long startTimeUs)
throws IOException { throws IOException {
ArrayList<WebvttCue> subtitles = new ArrayList<>(); ArrayList<WebvttCue> subtitles = new ArrayList<>();
long mediaTimestampUs = startTimeUs; long mediaTimestampUs = startTimeUs;
@ -253,7 +253,7 @@ public class WebvttParser implements SubtitleParser {
} }
@Override @Override
public boolean canParse(String mimeType) { public final boolean canParse(String mimeType) {
return MimeTypes.TEXT_VTT.equals(mimeType); return MimeTypes.TEXT_VTT.equals(mimeType);
} }

View File

@ -30,7 +30,7 @@ import java.util.List;
/** /**
* A representation of a WebVTT subtitle. * A representation of a WebVTT subtitle.
*/ */
public class WebvttSubtitle implements Subtitle { public final class WebvttSubtitle implements Subtitle {
private final List<WebvttCue> cues; private final List<WebvttCue> cues;
private final int numCues; private final int numCues;

View File

@ -24,7 +24,7 @@ import java.io.IOException;
/** /**
* A {@link DataSink} for writing to a byte array. * A {@link DataSink} for writing to a byte array.
*/ */
public class ByteArrayDataSink implements DataSink { public final class ByteArrayDataSink implements DataSink {
private ByteArrayOutputStream stream; private ByteArrayOutputStream stream;

View File

@ -23,7 +23,7 @@ import java.io.IOException;
/** /**
* A {@link DataSource} for reading from a byte array. * A {@link DataSource} for reading from a byte array.
*/ */
public class ByteArrayDataSource implements DataSource { public final class ByteArrayDataSource implements DataSource {
private final byte[] data; private final byte[] data;
private int readPosition; private int readPosition;

View File

@ -24,7 +24,7 @@ import java.io.InputStream;
* Allows data corresponding to a given {@link DataSpec} to be read from a {@link DataSource} and * Allows data corresponding to a given {@link DataSpec} to be read from a {@link DataSource} and
* consumed as an {@link InputStream}. * consumed as an {@link InputStream}.
*/ */
public class DataSourceInputStream extends InputStream { public final class DataSourceInputStream extends InputStream {
private final DataSource dataSource; private final DataSource dataSource;
private final DataSpec dataSpec; private final DataSpec dataSpec;

View File

@ -26,7 +26,7 @@ import android.os.Handler;
* Counts transferred bytes while transfers are open and creates a bandwidth sample and updated * Counts transferred bytes while transfers are open and creates a bandwidth sample and updated
* bandwidth estimate each time a transfer ends. * bandwidth estimate each time a transfer ends.
*/ */
public class DefaultBandwidthMeter implements BandwidthMeter { public final class DefaultBandwidthMeter implements BandwidthMeter {
public static final int DEFAULT_MAX_WEIGHT = 2000; public static final int DEFAULT_MAX_WEIGHT = 2000;

View File

@ -24,7 +24,7 @@ import java.io.IOException;
* priority is the highest priority of any task. {@link NetworkLock.PriorityTooLowException} is * priority is the highest priority of any task. {@link NetworkLock.PriorityTooLowException} is
* thrown when this condition does not hold. * thrown when this condition does not hold.
*/ */
public class PriorityDataSource implements DataSource { public final class PriorityDataSource implements DataSource {
private final DataSource upstream; private final DataSource upstream;
private final int priority; private final int priority;

View File

@ -27,7 +27,7 @@ import java.net.MulticastSocket;
/** /**
* A UDP {@link DataSource}. * A UDP {@link DataSource}.
*/ */
public class UdpDataSource implements UriDataSource { public final class UdpDataSource implements UriDataSource {
/** /**
* Thrown when an error is encountered when trying to read from a {@link UdpDataSource}. * Thrown when an error is encountered when trying to read from a {@link UdpDataSource}.

View File

@ -29,7 +29,7 @@ import java.io.IOException;
/** /**
* Writes data into a cache. * Writes data into a cache.
*/ */
public class CacheDataSink implements DataSink { public final class CacheDataSink implements DataSink {
private final Cache cache; private final Cache cache;
private final long maxCacheFileSize; private final long maxCacheFileSize;

View File

@ -21,7 +21,7 @@ import java.util.TreeSet;
/** /**
* Evicts least recently used cache files first. * Evicts least recently used cache files first.
*/ */
public class LeastRecentlyUsedCacheEvictor implements CacheEvictor, Comparator<CacheSpan> { public final class LeastRecentlyUsedCacheEvictor implements CacheEvictor, Comparator<CacheSpan> {
private final long maxBytes; private final long maxBytes;
private final TreeSet<CacheSpan> leastRecentlyUsed; private final TreeSet<CacheSpan> leastRecentlyUsed;

View File

@ -22,7 +22,7 @@ package com.google.android.exoplayer.upstream.cache;
* Warning: Using this evictor might have unforeseeable consequences if cache * Warning: Using this evictor might have unforeseeable consequences if cache
* size is not managed elsewhere. * size is not managed elsewhere.
*/ */
public class NoOpCacheEvictor implements CacheEvictor { public final class NoOpCacheEvictor implements CacheEvictor {
@Override @Override
public void onStartFile(Cache cache, String key, long position, long length) { public void onStartFile(Cache cache, String key, long position, long length) {

View File

@ -32,7 +32,7 @@ import java.util.TreeSet;
/** /**
* A {@link Cache} implementation that maintains an in-memory representation. * A {@link Cache} implementation that maintains an in-memory representation.
*/ */
public class SimpleCache implements Cache { public final class SimpleCache implements Cache {
private final File cacheDir; private final File cacheDir;
private final CacheEvictor evictor; private final CacheEvictor evictor;

View File

@ -23,7 +23,7 @@ import android.media.AudioFormat;
/** /**
* Defines common MIME types and helper methods. * Defines common MIME types and helper methods.
*/ */
public class MimeTypes { public final class MimeTypes {
public static final String BASE_TYPE_VIDEO = "video"; public static final String BASE_TYPE_VIDEO = "video";
public static final String BASE_TYPE_AUDIO = "audio"; public static final String BASE_TYPE_AUDIO = "audio";

View File

@ -21,7 +21,7 @@ import android.os.Process;
/** /**
* A {@link HandlerThread} with a specified process priority. * A {@link HandlerThread} with a specified process priority.
*/ */
public class PriorityHandlerThread extends HandlerThread { public final class PriorityHandlerThread extends HandlerThread {
private final int priority; private final int priority;

View File

@ -31,7 +31,7 @@ import java.util.Comparator;
* @see <a href="http://en.wikipedia.org/wiki/Moving_average">Wiki: Moving average</a> * @see <a href="http://en.wikipedia.org/wiki/Moving_average">Wiki: Moving average</a>
* @see <a href="http://en.wikipedia.org/wiki/Selection_algorithm">Wiki: Selection algorithm</a> * @see <a href="http://en.wikipedia.org/wiki/Selection_algorithm">Wiki: Selection algorithm</a>
*/ */
public class SlidingPercentile { public final class SlidingPercentile {
// Orderings. // Orderings.
private static final Comparator<Sample> INDEX_COMPARATOR = new Comparator<Sample>() { private static final Comparator<Sample> INDEX_COMPARATOR = new Comparator<Sample>() {

View File

@ -22,7 +22,9 @@ import android.annotation.TargetApi;
/** /**
* Calls through to {@link android.os.Trace} methods on supported API levels. * Calls through to {@link android.os.Trace} methods on supported API levels.
*/ */
public class TraceUtil { public final class TraceUtil {
private TraceUtil() {}
/** /**
* Writes a trace message to indicate that a given section of code has begun. * Writes a trace message to indicate that a given section of code has begun.

View File

@ -18,14 +18,12 @@ package com.google.android.exoplayer.util;
/** /**
* Utility class for managing a set of tags for which verbose logging should be enabled. * Utility class for managing a set of tags for which verbose logging should be enabled.
*/ */
public class VerboseLogUtil { public final class VerboseLogUtil {
private static volatile String[] enabledTags; private static volatile String[] enabledTags;
private static volatile boolean enableAllTags; private static volatile boolean enableAllTags;
private VerboseLogUtil() { private VerboseLogUtil() {}
// Private constructor to prevent instantiation.
}
/** /**
* Sets the tags for which verbose logging should be enabled. * Sets the tags for which verbose logging should be enabled.