Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ab67ab1a
authored
Jan 30, 2019
by
olly
Committed by
Oliver Woodman
Jan 30, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Implement database CachedContentIndex.Storage
PiperOrigin-RevId: 231600104
parent
c9b848e5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndexTest.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndex.java
View file @
ab67ab1a
This diff is collapsed.
Click to expand it.
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/SimpleCache.java
View file @
ab67ab1a
...
@@ -408,8 +408,8 @@ public final class SimpleCache implements Cache {
...
@@ -408,8 +408,8 @@ public final class SimpleCache implements Cache {
if
(
isRootDirectory
&&
fileName
.
indexOf
(
'.'
)
==
-
1
)
{
if
(
isRootDirectory
&&
fileName
.
indexOf
(
'.'
)
==
-
1
)
{
loadDirectory
(
file
,
/* isRootDirectory= */
false
);
loadDirectory
(
file
,
/* isRootDirectory= */
false
);
}
else
{
}
else
{
if
(
isRootDirectory
&&
CachedContentIndex
.
FILE_NAME
.
equals
(
fileName
))
{
if
(
isRootDirectory
&&
CachedContentIndex
.
isIndexFile
(
fileName
))
{
// Skip the (expected) index file in the root directory.
// Skip the (expected) index file
s
in the root directory.
continue
;
continue
;
}
}
long
fileLength
=
file
.
length
();
long
fileLength
=
file
.
length
();
...
...
library/core/src/test/java/com/google/android/exoplayer2/upstream/cache/CachedContentIndexTest.java
View file @
ab67ab1a
...
@@ -151,7 +151,8 @@ public class CachedContentIndexTest {
...
@@ -151,7 +151,8 @@ public class CachedContentIndexTest {
@Test
@Test
public
void
testLoadV1
()
throws
Exception
{
public
void
testLoadV1
()
throws
Exception
{
FileOutputStream
fos
=
new
FileOutputStream
(
new
File
(
cacheDir
,
CachedContentIndex
.
FILE_NAME
));
FileOutputStream
fos
=
new
FileOutputStream
(
new
File
(
cacheDir
,
CachedContentIndex
.
FILE_NAME_ATOMIC
));
fos
.
write
(
testIndexV1File
);
fos
.
write
(
testIndexV1File
);
fos
.
close
();
fos
.
close
();
...
@@ -169,7 +170,8 @@ public class CachedContentIndexTest {
...
@@ -169,7 +170,8 @@ public class CachedContentIndexTest {
@Test
@Test
public
void
testLoadV2
()
throws
Exception
{
public
void
testLoadV2
()
throws
Exception
{
FileOutputStream
fos
=
new
FileOutputStream
(
new
File
(
cacheDir
,
CachedContentIndex
.
FILE_NAME
));
FileOutputStream
fos
=
new
FileOutputStream
(
new
File
(
cacheDir
,
CachedContentIndex
.
FILE_NAME_ATOMIC
));
fos
.
write
(
testIndexV2File
);
fos
.
write
(
testIndexV2File
);
fos
.
close
();
fos
.
close
();
...
@@ -220,7 +222,7 @@ public class CachedContentIndexTest {
...
@@ -220,7 +222,7 @@ public class CachedContentIndexTest {
new
CachedContentIndex
(
cacheDir
,
key
),
new
CachedContentIndex
(
cacheDir
,
key
));
new
CachedContentIndex
(
cacheDir
,
key
),
new
CachedContentIndex
(
cacheDir
,
key
));
// Rename the index file from the test above
// Rename the index file from the test above
File
file1
=
new
File
(
cacheDir
,
CachedContentIndex
.
FILE_NAME
);
File
file1
=
new
File
(
cacheDir
,
CachedContentIndex
.
FILE_NAME
_ATOMIC
);
File
file2
=
new
File
(
cacheDir
,
"file2compare"
);
File
file2
=
new
File
(
cacheDir
,
"file2compare"
);
assertThat
(
file1
.
renameTo
(
file2
)).
isTrue
();
assertThat
(
file1
.
renameTo
(
file2
)).
isTrue
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment