com.google.android.exoplayer2.util.Util.createTempDirectory()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(278)

本文整理了Java中com.google.android.exoplayer2.util.Util.createTempDirectory()方法的一些代码示例,展示了Util.createTempDirectory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.createTempDirectory()方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:createTempDirectory

Util.createTempDirectory介绍

[英]Creates an empty directory in the directory returned by Context#getCacheDir().
[中]在上下文#getCacheDir()返回的目录中创建空目录。

代码示例

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. MockitoAnnotations.initMocks(this);
  4. cacheDir = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  5. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. MockitoAnnotations.initMocks(this);
  4. when(cache.addListener(anyString(), any(Cache.Listener.class))).thenReturn(new TreeSet<>());
  5. tracker = new CachedRegionTracker(cache, CACHE_KEY, CHUNK_INDEX);
  6. cacheDir = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  7. index = new CachedContentIndex(cacheDir);
  8. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. tempFolder = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  4. file = new File(tempFolder, "atomicFile");
  5. atomicFile = new AtomicFile(file);
  6. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. MockitoAnnotations.initMocks(this);
  4. tempFolder = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  5. cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());
  6. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. cacheDir =
  4. Util.createTempDirectory(InstrumentationRegistry.getTargetContext(), "ExoPlayerTest");
  5. index = new CachedContentIndex(cacheDir);
  6. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. MockitoAnnotations.initMocks(this);
  4. mockCache.init();
  5. tempFolder = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  6. cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());
  7. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. cacheDir =
  4. Util.createTempDirectory(InstrumentationRegistry.getTargetContext(), "ExoPlayerTest");
  5. index = new CachedContentIndex(cacheDir);
  6. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. testDataUri = Uri.parse("test_data");
  4. fixedCacheKey = CacheUtil.generateKey(testDataUri);
  5. expectedCacheKey = fixedCacheKey;
  6. cacheKeyFactory = dataSpec -> CACHE_KEY_PREFIX + "." + CacheUtil.generateKey(dataSpec.uri);
  7. tempFolder = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  8. cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());
  9. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. dummyMainThread = new DummyMainThread();
  4. Context context = RuntimeEnvironment.application;
  5. tempFolder = Util.createTempDirectory(context, "ExoPlayerTest");
  6. File cacheFolder = new File(tempFolder, "cache");
  7. cacheFolder.mkdir();
  8. cache = new SimpleCache(cacheFolder, new NoOpCacheEvictor());
  9. MockitoAnnotations.initMocks(this);
  10. fakeDataSet =
  11. new FakeDataSet()
  12. .setData(TEST_MPD_URI, TEST_MPD)
  13. .setRandomData("audio_init_data", 10)
  14. .setRandomData("audio_segment_1", 4)
  15. .setRandomData("audio_segment_2", 5)
  16. .setRandomData("audio_segment_3", 6)
  17. .setRandomData("text_segment_1", 1)
  18. .setRandomData("text_segment_2", 2)
  19. .setRandomData("text_segment_3", 3);
  20. fakeStreamKey1 = new StreamKey(0, 0, 0);
  21. fakeStreamKey2 = new StreamKey(0, 1, 0);
  22. actionFile = new File(tempFolder, "actionFile");
  23. createDownloadManager();
  24. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. tempFolder = Util.createTempDirectory(RuntimeEnvironment.application, "ExoPlayerTest");
  4. cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());
  5. fakeDataSet =
  6. new FakeDataSet()
  7. .setData(MASTER_PLAYLIST_URI, MASTER_PLAYLIST_DATA)
  8. .setData(MEDIA_PLAYLIST_1_URI, MEDIA_PLAYLIST_DATA)
  9. .setRandomData(MEDIA_PLAYLIST_1_DIR + "fileSequence0.ts", 10)
  10. .setRandomData(MEDIA_PLAYLIST_1_DIR + "fileSequence1.ts", 11)
  11. .setRandomData(MEDIA_PLAYLIST_1_DIR + "fileSequence2.ts", 12)
  12. .setData(MEDIA_PLAYLIST_2_URI, MEDIA_PLAYLIST_DATA)
  13. .setRandomData(MEDIA_PLAYLIST_2_DIR + "fileSequence0.ts", 13)
  14. .setRandomData(MEDIA_PLAYLIST_2_DIR + "fileSequence1.ts", 14)
  15. .setRandomData(MEDIA_PLAYLIST_2_DIR + "fileSequence2.ts", 15);
  16. }

代码示例来源:origin: google/ExoPlayer

  1. @Before
  2. public void setUp() throws Exception {
  3. testRunner =
  4. new DashTestRunner(TAG, testRule.getActivity(), getInstrumentation())
  5. .setManifestUrl(DashTestData.H264_MANIFEST)
  6. .setFullPlaybackNoSeeking(true)
  7. .setCanIncludeAdditionalVideoFormats(false)
  8. .setAudioVideoFormats(
  9. DashTestData.AAC_AUDIO_REPRESENTATION_ID, DashTestData.H264_CDD_FIXED);
  10. tempFolder = Util.createTempDirectory(testRule.getActivity(), "ExoPlayerTest");
  11. cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());
  12. httpDataSourceFactory = new DefaultHttpDataSourceFactory("ExoPlayer", null);
  13. offlineDataSourceFactory =
  14. new CacheDataSourceFactory(
  15. cache, DummyDataSource.FACTORY, CacheDataSource.FLAG_BLOCK_ON_CACHE);
  16. }

代码示例来源:origin: google/ExoPlayer

  1. dummyMainThread = new DummyMainThread();
  2. context = RuntimeEnvironment.application;
  3. tempFolder = Util.createTempDirectory(context, "ExoPlayerTest");
  4. cache = new SimpleCache(tempFolder, new NoOpCacheEvictor());

相关文章