Package org.robolectric.shadows.util
Class DataSource
- java.lang.Object
-
- org.robolectric.shadows.util.DataSource
-
public class DataSource extends Object
Opaque class for uniquely identifying a media data source, as used byShadowMediaPlayer
,ShadowMediaMetadataRetriever
, andShadowMediaExtractor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
DataSource.FileDescriptorTransform
Transform aFileDescriptor
to a string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
hashCode()
static void
reset()
static void
setFileDescriptorTransform(DataSource.FileDescriptorTransform transform)
Optional transformation forFileDescriptor
.static DataSource
toDataSource(Context context, Uri uri)
static DataSource
toDataSource(Context context, Uri uri, Map<String,String> headers)
static DataSource
toDataSource(Context context, Uri uri, Map<String,String> headers, List<HttpCookie> cookies)
static DataSource
toDataSource(AssetFileDescriptor assetFileDescriptor)
static DataSource
toDataSource(MediaDataSource mediaDataSource)
static DataSource
toDataSource(FileDescriptor fd)
static DataSource
toDataSource(FileDescriptor fd, long offset, long length)
static DataSource
toDataSource(String path)
static DataSource
toDataSource(String uri, Map<String,String> headers)
-
-
-
Method Detail
-
setFileDescriptorTransform
public static void setFileDescriptorTransform(DataSource.FileDescriptorTransform transform)
Optional transformation forFileDescriptor
.Helpful for associating a real test file to the data source used by shadow objects in stubbed methods.
-
toDataSource
public static DataSource toDataSource(String path)
-
toDataSource
public static DataSource toDataSource(Context context, Uri uri)
-
toDataSource
public static DataSource toDataSource(Context context, Uri uri, Map<String,String> headers)
-
toDataSource
public static DataSource toDataSource(Context context, Uri uri, Map<String,String> headers, List<HttpCookie> cookies)
-
toDataSource
public static DataSource toDataSource(String uri, Map<String,String> headers)
-
toDataSource
public static DataSource toDataSource(FileDescriptor fd)
-
toDataSource
public static DataSource toDataSource(MediaDataSource mediaDataSource)
-
toDataSource
public static DataSource toDataSource(AssetFileDescriptor assetFileDescriptor)
-
toDataSource
public static DataSource toDataSource(FileDescriptor fd, long offset, long length)
-
reset
public static void reset()
-
-