136 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
			
		
		
	
	
			136 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
| .class public final Lcom/google/android/exoplayer2/upstream/ByteArrayDataSink;
 | |
| .super Ljava/lang/Object;
 | |
| .source "ByteArrayDataSink.java"
 | |
| 
 | |
| # interfaces
 | |
| .implements Lcom/google/android/exoplayer2/upstream/DataSink;
 | |
| 
 | |
| 
 | |
| # instance fields
 | |
| .field private stream:Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
| 
 | |
| # direct methods
 | |
| .method public constructor <init>()V
 | |
|     .locals 0
 | |
| 
 | |
|     .line 1
 | |
|     invoke-direct {p0}, Ljava/lang/Object;-><init>()V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| 
 | |
| # virtual methods
 | |
| .method public close()V
 | |
|     .locals 1
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Ljava/io/IOException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     iget-object v0, p0, Lcom/google/android/exoplayer2/upstream/ByteArrayDataSink;->stream:Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->close()V
 | |
| 
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public getData()[B
 | |
|     .locals 1
 | |
| 
 | |
|     .line 1
 | |
|     iget-object v0, p0, Lcom/google/android/exoplayer2/upstream/ByteArrayDataSink;->stream:Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     if-nez v0, :cond_0
 | |
| 
 | |
|     const/4 v0, 0x0
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_0
 | |
|     invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
 | |
| 
 | |
|     move-result-object v0
 | |
| 
 | |
|     :goto_0
 | |
|     return-object v0
 | |
| .end method
 | |
| 
 | |
| .method public open(Lcom/google/android/exoplayer2/upstream/DataSpec;)V
 | |
|     .locals 4
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Ljava/io/IOException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     iget-wide v0, p1, Lcom/google/android/exoplayer2/upstream/DataSpec;->length:J
 | |
| 
 | |
|     const-wide/16 v2, -0x1
 | |
| 
 | |
|     cmp-long v2, v0, v2
 | |
| 
 | |
|     if-nez v2, :cond_0
 | |
| 
 | |
|     .line 2
 | |
|     new-instance p1, Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     invoke-direct {p1}, Ljava/io/ByteArrayOutputStream;-><init>()V
 | |
| 
 | |
|     iput-object p1, p0, Lcom/google/android/exoplayer2/upstream/ByteArrayDataSink;->stream:Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     goto :goto_1
 | |
| 
 | |
|     :cond_0
 | |
|     const-wide/32 v2, 0x7fffffff
 | |
| 
 | |
|     cmp-long v0, v0, v2
 | |
| 
 | |
|     if-gtz v0, :cond_1
 | |
| 
 | |
|     const/4 v0, 0x1
 | |
| 
 | |
|     goto :goto_0
 | |
| 
 | |
|     :cond_1
 | |
|     const/4 v0, 0x0
 | |
| 
 | |
|     .line 3
 | |
|     :goto_0
 | |
|     invoke-static {v0}, Lcom/google/android/exoplayer2/util/Assertions;->checkArgument(Z)V
 | |
| 
 | |
|     .line 4
 | |
|     new-instance v0, Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     iget-wide v1, p1, Lcom/google/android/exoplayer2/upstream/DataSpec;->length:J
 | |
| 
 | |
|     long-to-int p1, v1
 | |
| 
 | |
|     invoke-direct {v0, p1}, Ljava/io/ByteArrayOutputStream;-><init>(I)V
 | |
| 
 | |
|     iput-object v0, p0, Lcom/google/android/exoplayer2/upstream/ByteArrayDataSink;->stream:Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     :goto_1
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| .method public write([BII)V
 | |
|     .locals 1
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Ljava/io/IOException;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     iget-object v0, p0, Lcom/google/android/exoplayer2/upstream/ByteArrayDataSink;->stream:Ljava/io/ByteArrayOutputStream;
 | |
| 
 | |
|     invoke-virtual {v0, p1, p2, p3}, Ljava/io/ByteArrayOutputStream;->write([BII)V
 | |
| 
 | |
|     return-void
 | |
| .end method
 |