123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- .class final Lokhttp3/internal/cache2/FileOperator;
- .super Ljava/lang/Object;
- .source ""
- # static fields
- .field private static final BUFFER_SIZE:I = 0x2000
- # instance fields
- .field private final byteArray:[B
- .field private final byteBuffer:Ljava/nio/ByteBuffer;
- .field private final fileChannel:Ljava/nio/channels/FileChannel;
- # direct methods
- .method constructor <init>(Ljava/nio/channels/FileChannel;)V
- .locals 1
- invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- const/16 v0, 0x2000
- new-array v0, v0, [B
- iput-object v0, p0, Lokhttp3/internal/cache2/FileOperator;->byteArray:[B
- iget-object v0, p0, Lokhttp3/internal/cache2/FileOperator;->byteArray:[B
- invoke-static {v0}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;
- move-result-object v0
- iput-object v0, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- iput-object p1, p0, Lokhttp3/internal/cache2/FileOperator;->fileChannel:Ljava/nio/channels/FileChannel;
- return-void
- .end method
- # virtual methods
- .method public read(JLokio/Buffer;J)V
- .locals 5
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const-wide/16 v0, 0x0
- cmp-long v2, p4, v0
- if-ltz v2, :cond_2
- :goto_0
- cmp-long v2, p4, v0
- if-lez v2, :cond_1
- :try_start_0
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- const-wide/16 v3, 0x2000
- invoke-static {v3, v4, p4, p5}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v3
- long-to-int v4, v3
- invoke-virtual {v2, v4}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->fileChannel:Ljava/nio/channels/FileChannel;
- iget-object v3, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2, v3, p1, p2}, Ljava/nio/channels/FileChannel;->read(Ljava/nio/ByteBuffer;J)I
- move-result v2
- const/4 v3, -0x1
- if-eq v2, v3, :cond_0
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2}, Ljava/nio/ByteBuffer;->position()I
- move-result v2
- iget-object v3, p0, Lokhttp3/internal/cache2/FileOperator;->byteArray:[B
- const/4 v4, 0x0
- invoke-virtual {p3, v3, v4, v2}, Lokio/Buffer;->write([BII)Lokio/Buffer;
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- int-to-long v2, v2
- add-long/2addr p1, v2
- sub-long/2addr p4, v2
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
- goto :goto_0
- :cond_0
- :try_start_1
- new-instance p1, Ljava/io/EOFException;
- invoke-direct {p1}, Ljava/io/EOFException;-><init>()V
- throw p1
- :try_end_1
- .catchall {:try_start_1 .. :try_end_1} :catchall_0
- :catchall_0
- move-exception p1
- iget-object p2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {p2}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
- throw p1
- :cond_1
- return-void
- :cond_2
- new-instance p1, Ljava/lang/IndexOutOfBoundsException;
- invoke-direct {p1}, Ljava/lang/IndexOutOfBoundsException;-><init>()V
- goto :goto_2
- :goto_1
- throw p1
- :goto_2
- goto :goto_1
- .end method
- .method public write(JLokio/Buffer;J)V
- .locals 6
- .annotation system Ldalvik/annotation/Throws;
- value = {
- Ljava/io/IOException;
- }
- .end annotation
- const-wide/16 v0, 0x0
- cmp-long v2, p4, v0
- if-ltz v2, :cond_2
- invoke-virtual {p3}, Lokio/Buffer;->size()J
- move-result-wide v2
- cmp-long v4, p4, v2
- if-gtz v4, :cond_2
- :goto_0
- cmp-long v2, p4, v0
- if-lez v2, :cond_1
- const-wide/16 v2, 0x2000
- :try_start_0
- invoke-static {v2, v3, p4, p5}, Ljava/lang/Math;->min(JJ)J
- move-result-wide v2
- long-to-int v3, v2
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteArray:[B
- const/4 v4, 0x0
- invoke-virtual {p3, v2, v4, v3}, Lokio/Buffer;->read([BII)I
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2, v3}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
- :cond_0
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->fileChannel:Ljava/nio/channels/FileChannel;
- iget-object v4, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2, v4, p1, p2}, Ljava/nio/channels/FileChannel;->write(Ljava/nio/ByteBuffer;J)I
- move-result v2
- int-to-long v4, v2
- add-long/2addr p1, v4
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2}, Ljava/nio/ByteBuffer;->hasRemaining()Z
- move-result v2
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
- if-nez v2, :cond_0
- int-to-long v2, v3
- sub-long/2addr p4, v2
- iget-object v2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {v2}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
- goto :goto_0
- :catchall_0
- move-exception p1
- iget-object p2, p0, Lokhttp3/internal/cache2/FileOperator;->byteBuffer:Ljava/nio/ByteBuffer;
- invoke-virtual {p2}, Ljava/nio/ByteBuffer;->clear()Ljava/nio/Buffer;
- throw p1
- :cond_1
- return-void
- :cond_2
- new-instance p1, Ljava/lang/IndexOutOfBoundsException;
- invoke-direct {p1}, Ljava/lang/IndexOutOfBoundsException;-><init>()V
- goto :goto_2
- :goto_1
- throw p1
- :goto_2
- goto :goto_1
- .end method
|