.class public final Landroidx/media3/datasource/FileDataSource; .super Landroidx/media3/datasource/BaseDataSource; .source "FileDataSource.java" # annotations .annotation system Ldalvik/annotation/MemberClasses; value = { Landroidx/media3/datasource/FileDataSource$FileDataSourceException;, Landroidx/media3/datasource/FileDataSource$Api21;, Landroidx/media3/datasource/FileDataSource$Factory; } .end annotation # instance fields .field private bytesRemaining:J .field private file:Ljava/io/RandomAccessFile; .field private opened:Z .field private uri:Landroid/net/Uri; # direct methods .method public constructor ()V .locals 1 const/4 v0, 0x0 .line 108 invoke-direct {p0, v0}, Landroidx/media3/datasource/BaseDataSource;->(Z)V return-void .end method .method private static openLocalFile(Landroid/net/Uri;)Ljava/io/RandomAccessFile; .locals 4 .annotation system Ldalvik/annotation/Throws; value = { Landroidx/media3/datasource/FileDataSource$FileDataSourceException; } .end annotation const/16 v0, 0x7d6 .line 186 :try_start_0 new-instance v1, Ljava/io/RandomAccessFile; invoke-virtual {p0}, Landroid/net/Uri;->getPath()Ljava/lang/String; move-result-object v2 invoke-static {v2}, Landroidx/media3/common/util/Assertions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v2 check-cast v2, Ljava/lang/String; const-string v3, "r" invoke-direct {v1, v2, v3}, Ljava/io/RandomAccessFile;->(Ljava/lang/String;Ljava/lang/String;)V :try_end_0 .catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_2 .catch Ljava/lang/SecurityException; {:try_start_0 .. :try_end_0} :catch_1 .catch Ljava/lang/RuntimeException; {:try_start_0 .. :try_end_0} :catch_0 return-object v1 :catch_0 move-exception p0 .line 209 new-instance v0, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; const/16 v1, 0x7d0 invoke-direct {v0, p0, v1}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/Throwable;I)V throw v0 :catch_1 move-exception p0 .line 207 new-instance v1, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; invoke-direct {v1, p0, v0}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/Throwable;I)V throw v1 :catch_2 move-exception v1 .line 188 invoke-virtual {p0}, Landroid/net/Uri;->getQuery()Ljava/lang/String; move-result-object v2 invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z move-result v2 if-eqz v2, :cond_1 invoke-virtual {p0}, Landroid/net/Uri;->getFragment()Ljava/lang/String; move-result-object v2 invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z move-result v2 if-eqz v2, :cond_1 .line 201 new-instance p0, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; .line 203 sget v2, Landroidx/media3/common/util/Util;->SDK_INT:I const/16 v3, 0x15 if-lt v2, v3, :cond_0 invoke-virtual {v1}, Ljava/io/FileNotFoundException;->getCause()Ljava/lang/Throwable; move-result-object v2 invoke-static {v2}, Landroidx/media3/datasource/FileDataSource$Api21;->access$000(Ljava/lang/Throwable;)Z move-result v2 if-eqz v2, :cond_0 goto :goto_0 :cond_0 const/16 v0, 0x7d5 .line 205 :goto_0 invoke-direct {p0, v1, v0}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/Throwable;I)V throw p0 .line 189 :cond_1 new-instance v0, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; .line 194 invoke-virtual {p0}, Landroid/net/Uri;->getPath()Ljava/lang/String; move-result-object v2 invoke-virtual {p0}, Landroid/net/Uri;->getQuery()Ljava/lang/String; move-result-object v3 invoke-virtual {p0}, Landroid/net/Uri;->getFragment()Ljava/lang/String; move-result-object p0 filled-new-array {v2, v3, p0}, [Ljava/lang/Object; move-result-object p0 const-string v2, "uri has query and/or fragment, which are not supported. Did you call Uri.parse() on a string containing \'?\' or \'#\'? Use Uri.fromFile(new File(path)) to avoid this. path=%s,query=%s,fragment=%s" .line 190 invoke-static {v2, p0}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; move-result-object p0 const/16 v2, 0x3ec invoke-direct {v0, p0, v1, v2}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/String;Ljava/lang/Throwable;I)V throw v0 .end method # virtual methods .method public close()V .locals 5 .annotation system Ldalvik/annotation/Throws; value = { Landroidx/media3/datasource/FileDataSource$FileDataSourceException; } .end annotation const/4 v0, 0x0 iput-object v0, p0, Landroidx/media3/datasource/FileDataSource;->uri:Landroid/net/Uri; const/4 v1, 0x0 :try_start_0 iget-object v2, p0, Landroidx/media3/datasource/FileDataSource;->file:Ljava/io/RandomAccessFile; if-eqz v2, :cond_0 .line 171 invoke-virtual {v2}, Ljava/io/RandomAccessFile;->close()V :try_end_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 :cond_0 iput-object v0, p0, Landroidx/media3/datasource/FileDataSource;->file:Ljava/io/RandomAccessFile; iget-boolean v0, p0, Landroidx/media3/datasource/FileDataSource;->opened:Z if-eqz v0, :cond_1 iput-boolean v1, p0, Landroidx/media3/datasource/FileDataSource;->opened:Z .line 179 invoke-virtual {p0}, Landroidx/media3/datasource/FileDataSource;->transferEnded()V :cond_1 return-void :catchall_0 move-exception v2 goto :goto_0 :catch_0 move-exception v2 .line 174 :try_start_1 new-instance v3, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; const/16 v4, 0x7d0 invoke-direct {v3, v2, v4}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/Throwable;I)V throw v3 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 :goto_0 iput-object v0, p0, Landroidx/media3/datasource/FileDataSource;->file:Ljava/io/RandomAccessFile; iget-boolean v0, p0, Landroidx/media3/datasource/FileDataSource;->opened:Z if-eqz v0, :cond_2 iput-boolean v1, p0, Landroidx/media3/datasource/FileDataSource;->opened:Z .line 179 invoke-virtual {p0}, Landroidx/media3/datasource/FileDataSource;->transferEnded()V .line 181 :cond_2 throw v2 .end method .method public getUri()Landroid/net/Uri; .locals 0 iget-object p0, p0, Landroidx/media3/datasource/FileDataSource;->uri:Landroid/net/Uri; return-object p0 .end method .method public open(Landroidx/media3/datasource/DataSpec;)J .locals 4 .annotation system Ldalvik/annotation/Throws; value = { Landroidx/media3/datasource/FileDataSource$FileDataSourceException; } .end annotation .line 113 iget-object v0, p1, Landroidx/media3/datasource/DataSpec;->uri:Landroid/net/Uri; iput-object v0, p0, Landroidx/media3/datasource/FileDataSource;->uri:Landroid/net/Uri; .line 115 invoke-virtual {p0, p1}, Landroidx/media3/datasource/FileDataSource;->transferInitializing(Landroidx/media3/datasource/DataSpec;)V .line 116 invoke-static {v0}, Landroidx/media3/datasource/FileDataSource;->openLocalFile(Landroid/net/Uri;)Ljava/io/RandomAccessFile; move-result-object v0 iput-object v0, p0, Landroidx/media3/datasource/FileDataSource;->file:Ljava/io/RandomAccessFile; .line 118 :try_start_0 iget-wide v1, p1, Landroidx/media3/datasource/DataSpec;->position:J invoke-virtual {v0, v1, v2}, Ljava/io/RandomAccessFile;->seek(J)V .line 120 iget-wide v0, p1, Landroidx/media3/datasource/DataSpec;->length:J const-wide/16 v2, -0x1 cmp-long v0, v0, v2 if-nez v0, :cond_0 iget-object v0, p0, Landroidx/media3/datasource/FileDataSource;->file:Ljava/io/RandomAccessFile; invoke-virtual {v0}, Ljava/io/RandomAccessFile;->length()J move-result-wide v0 iget-wide v2, p1, Landroidx/media3/datasource/DataSpec;->position:J sub-long/2addr v0, v2 goto :goto_0 :cond_0 iget-wide v0, p1, Landroidx/media3/datasource/DataSpec;->length:J :goto_0 iput-wide v0, p0, Landroidx/media3/datasource/FileDataSource;->bytesRemaining:J :try_end_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0 const-wide/16 v2, 0x0 cmp-long v0, v0, v2 if-ltz v0, :cond_1 const/4 v0, 0x1 iput-boolean v0, p0, Landroidx/media3/datasource/FileDataSource;->opened:Z .line 132 invoke-virtual {p0, p1}, Landroidx/media3/datasource/FileDataSource;->transferStarted(Landroidx/media3/datasource/DataSpec;)V iget-wide p0, p0, Landroidx/media3/datasource/FileDataSource;->bytesRemaining:J return-wide p0 .line 125 :cond_1 new-instance p0, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; const/16 p1, 0x7d8 const/4 v0, 0x0 invoke-direct {p0, v0, v0, p1}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/String;Ljava/lang/Throwable;I)V throw p0 :catch_0 move-exception p0 .line 122 new-instance p1, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; const/16 v0, 0x7d0 invoke-direct {p1, p0, v0}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/Throwable;I)V throw p1 .end method .method public read([BII)I .locals 5 .annotation system Ldalvik/annotation/Throws; value = { Landroidx/media3/datasource/FileDataSource$FileDataSourceException; } .end annotation if-nez p3, :cond_0 const/4 p0, 0x0 return p0 :cond_0 iget-wide v0, p0, Landroidx/media3/datasource/FileDataSource;->bytesRemaining:J const-wide/16 v2, 0x0 cmp-long v0, v0, v2 if-nez v0, :cond_1 const/4 p0, -0x1 return p0 :cond_1 :try_start_0 iget-object v0, p0, Landroidx/media3/datasource/FileDataSource;->file:Ljava/io/RandomAccessFile; .line 146 invoke-static {v0}, Landroidx/media3/common/util/Util;->castNonNull(Ljava/lang/Object;)Ljava/lang/Object; move-result-object v0 check-cast v0, Ljava/io/RandomAccessFile; iget-wide v1, p0, Landroidx/media3/datasource/FileDataSource;->bytesRemaining:J int-to-long v3, p3 invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->min(JJ)J move-result-wide v1 long-to-int p3, v1 invoke-virtual {v0, p1, p2, p3}, Ljava/io/RandomAccessFile;->read([BII)I move-result p1 :try_end_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0 if-lez p1, :cond_2 iget-wide p2, p0, Landroidx/media3/datasource/FileDataSource;->bytesRemaining:J int-to-long v0, p1 sub-long/2addr p2, v0 iput-wide p2, p0, Landroidx/media3/datasource/FileDataSource;->bytesRemaining:J .line 153 invoke-virtual {p0, p1}, Landroidx/media3/datasource/FileDataSource;->bytesTransferred(I)V :cond_2 return p1 :catch_0 move-exception p0 .line 148 new-instance p1, Landroidx/media3/datasource/FileDataSource$FileDataSourceException; const/16 p2, 0x7d0 invoke-direct {p1, p0, p2}, Landroidx/media3/datasource/FileDataSource$FileDataSourceException;->(Ljava/lang/Throwable;I)V throw p1 .end method