@UnstableApi
public class CacheSpan implements Comparable


Defines a span of data that may or may not be cached (as indicated by isCached).

Summary

Public fields

final @Nullable File

The file corresponding to this CacheSpan, or null if isCached is false.

final boolean

Whether the CacheSpan is cached.

final String

The cache key that uniquely identifies the resource.

final long

The last touch timestamp, or TIME_UNSET if isCached is false.

final long

The length of the CacheSpan, or LENGTH_UNSET if this is an open-ended hole.

final long

The position of the CacheSpan in the resource.

Public constructors

CacheSpan(String key, long position, long length)

Creates a hole CacheSpan which isn't cached, has no last touch timestamp and no file associated.

CacheSpan(
    String key,
    long position,
    long length,
    long lastTouchTimestamp,
    @Nullable File file
)

Creates a CacheSpan.

Public methods

int
boolean

Returns whether this is a hole CacheSpan.

boolean

Returns whether this is an open-ended CacheSpan.

String

Public fields

file

public final @Nullable File file

The file corresponding to this CacheSpan, or null if isCached is false.

isCached

public final boolean isCached

Whether the CacheSpan is cached.

key

public final String key

The cache key that uniquely identifies the resource.

lastTouchTimestamp

public final long lastTouchTimestamp

The last touch timestamp, or TIME_UNSET if isCached is false.

length

public final long length

The length of the CacheSpan, or LENGTH_UNSET if this is an open-ended hole.

position

public final long position

The position of the CacheSpan in the resource.

Public constructors

CacheSpan

public CacheSpan(String key, long position, long length)

Creates a hole CacheSpan which isn't cached, has no last touch timestamp and no file associated.

Parameters
String key

The cache key that uniquely identifies the resource.

long position

The position of the CacheSpan in the resource.

long length

The length of the CacheSpan, or LENGTH_UNSET if this is an open-ended hole.

CacheSpan

public CacheSpan(
    String key,
    long position,
    long length,
    long lastTouchTimestamp,
    @Nullable File file
)

Creates a CacheSpan.

Parameters
String key

The cache key that uniquely identifies the resource.

long position

The position of the CacheSpan in the resource.

long length

The length of the CacheSpan, or LENGTH_UNSET if this is an open-ended hole.

long lastTouchTimestamp

The last touch timestamp, or TIME_UNSET if isCached is false.

@Nullable File file

The file corresponding to this CacheSpan, or null if it's a hole.

Public methods

compareTo

public int compareTo(CacheSpan another)

isHoleSpan

public boolean isHoleSpan()

Returns whether this is a hole CacheSpan.

isOpenEnded

public boolean isOpenEnded()

Returns whether this is an open-ended CacheSpan.

toString

public String toString()