lightbulb_outline Please take our October 2018 developer survey. Start survey

FileDataSourceDesc2.Builder

public static final class FileDataSourceDesc2.Builder
extends Builder<FileDataSourceDesc2.Builder>

java.lang.Object
   ↳ androidx.media2.DataSourceDesc2.Builder<androidx.media2.FileDataSourceDesc2.Builder>
     ↳ androidx.media2.FileDataSourceDesc2.Builder


This Builder class simplifies the creation of a FileDataSourceDesc2 object.

Summary

Public constructors

FileDataSourceDesc2.Builder(FileDescriptor fd)

Creates a new Builder object with a data source (FileDescriptor) to use.

FileDataSourceDesc2.Builder(FileDescriptor fd, long offset, long length)

Creates a new Builder object with a data source (FileDescriptor) to use.

Public methods

FileDataSourceDesc2 build()

Inherited methods

Public constructors

FileDataSourceDesc2.Builder

public FileDataSourceDesc2.Builder (FileDescriptor fd)

Creates a new Builder object with a data source (FileDescriptor) to use. The FileDescriptor must be seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility to close the file descriptor after the source has been used.

Parameters
fd FileDescriptor: the FileDescriptor for the file you want to play

FileDataSourceDesc2.Builder

public FileDataSourceDesc2.Builder (FileDescriptor fd, 
                long offset, 
                long length)

Creates a new Builder object with a data source (FileDescriptor) to use. The FileDescriptor must be seekable (N.B. a LocalSocket is not seekable). It is the caller's responsibility to close the file descriptor after the source has been used. Any negative number for offset is treated as 0. Any negative number for length is treated as maximum length of the data source.

Parameters
fd FileDescriptor: the FileDescriptor for the file you want to play

offset long: the offset into the file where the data to be played starts, in bytes

length long: the length in bytes of the data to be played

Public methods

build

public FileDataSourceDesc2 build ()

Returns
FileDataSourceDesc2 A new FileDataSourceDesc2 with values supplied by the Builder.