ByteBufferByteChannel.smali
.class public Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;
.super Ljava/lang/Object;
.source "ByteBufferByteChannel.java"
# interfaces
.implements Ljava/nio/channels/ByteChannel;
# instance fields
.field byteBuffer:Ljava/nio/ByteBuffer;
# direct methods
.method static constructor <clinit>()V
.registers 1
return-void
.end method
.method public constructor <init>(Ljava/nio/ByteBuffer;)V
.registers 2
.param p1, "byteBuffer" # Ljava/nio/ByteBuffer;
.line 29
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 30
iput-object p1, p0, Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;->byteBuffer:Ljava/nio/ByteBuffer;
.line 31
return-void
.end method
# virtual methods
.method public close()V
.registers 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 48
return-void
.end method
.method public isOpen()Z
.registers 2
.line 44
const/4 v0, 0x1
return v0
.end method
.method public read(Ljava/nio/ByteBuffer;)I
.registers 6
.param p1, "dst" # Ljava/nio/ByteBuffer;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 34
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
move-result v0
.line 35
.local v0, "rem":I
iget-object v1, p0, Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;->byteBuffer:Ljava/nio/ByteBuffer;
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->remaining()I
move-result v1
if-gtz v1, :cond_e
.line 36
const/4 v1, -0x1
return v1
.line 38
:cond_e
iget-object v1, p0, Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;->byteBuffer:Ljava/nio/ByteBuffer;
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->duplicate()Ljava/nio/ByteBuffer;
move-result-object v1
iget-object v2, p0, Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;->byteBuffer:Ljava/nio/ByteBuffer;
invoke-virtual {v2}, Ljava/nio/ByteBuffer;->position()I
move-result v2
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
move-result v3
add-int/2addr v2, v3
invoke-virtual {v1, v2}, Ljava/nio/ByteBuffer;->limit(I)Ljava/nio/Buffer;
move-result-object v1
check-cast v1, Ljava/nio/ByteBuffer;
invoke-virtual {p1, v1}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
.line 39
iget-object v1, p0, Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;->byteBuffer:Ljava/nio/ByteBuffer;
invoke-virtual {v1}, Ljava/nio/ByteBuffer;->position()I
move-result v2
add-int/2addr v2, v0
invoke-virtual {v1, v2}, Ljava/nio/ByteBuffer;->position(I)Ljava/nio/Buffer;
.line 40
return v0
.end method
.method public write(Ljava/nio/ByteBuffer;)I
.registers 4
.param p1, "src" # Ljava/nio/ByteBuffer;
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 51
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->remaining()I
move-result v0
.line 52
.local v0, "r":I
iget-object v1, p0, Lcom/googlecode/mp4parser/util/ByteBufferByteChannel;->byteBuffer:Ljava/nio/ByteBuffer;
invoke-virtual {v1, p1}, Ljava/nio/ByteBuffer;->put(Ljava/nio/ByteBuffer;)Ljava/nio/ByteBuffer;
.line 53
return v0
.end method