mirror of
https://github.com/samsonjs/media.git
synced 2026-04-10 12:05:47 +00:00
Document how unset length request are cached
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=180929422
This commit is contained in:
parent
5364962dca
commit
4b018b4d19
3 changed files with 13 additions and 2 deletions
|
|
@ -49,7 +49,8 @@ public final class DataSpec {
|
|||
public static final int FLAG_ALLOW_GZIP = 1 << 0;
|
||||
|
||||
/**
|
||||
* Permits content to be cached even if its length can not be resolved.
|
||||
* Permits content to be cached even if its length can not be resolved. Typically this's the case
|
||||
* for progressive live streams and when {@link #FLAG_ALLOW_GZIP} is used.
|
||||
*/
|
||||
public static final int FLAG_ALLOW_CACHING_UNKNOWN_LENGTH = 1 << 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ import java.io.OutputStream;
|
|||
|
||||
/**
|
||||
* Writes data into a cache.
|
||||
*
|
||||
* <p>If the {@link DataSpec} object used with {@link #open(DataSpec)} method call has the {@code
|
||||
* length} field set to {@link C#LENGTH_UNSET} but {@link
|
||||
* DataSpec#FLAG_ALLOW_CACHING_UNKNOWN_LENGTH} isn't set then {@link #write(byte[], int, int)} calls
|
||||
* are ignored.
|
||||
*/
|
||||
public final class CacheDataSink implements DataSink {
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,10 @@ import java.lang.annotation.RetentionPolicy;
|
|||
* A {@link DataSource} that reads and writes a {@link Cache}. Requests are fulfilled from the cache
|
||||
* when possible. When data is not cached it is requested from an upstream {@link DataSource} and
|
||||
* written into the cache.
|
||||
*
|
||||
* <p>By default requests whose length can not be resolved are not cached. This is to prevent
|
||||
* caching of progressive live streams, which should usually not be cached. Caching of this kind of
|
||||
* requests can be enabled per request with {@link DataSpec#FLAG_ALLOW_CACHING_UNKNOWN_LENGTH}.
|
||||
*/
|
||||
public final class CacheDataSource implements DataSource {
|
||||
|
||||
|
|
@ -67,7 +71,8 @@ public final class CacheDataSource implements DataSource {
|
|||
public static final int FLAG_IGNORE_CACHE_ON_ERROR = 1 << 1;
|
||||
|
||||
/**
|
||||
* A flag indicating that the cache should be bypassed for requests whose lengths are unset.
|
||||
* A flag indicating that the cache should be bypassed for requests whose lengths are unset. This
|
||||
* flag is provided for legacy reasons only.
|
||||
*/
|
||||
public static final int FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS = 1 << 2;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue