150 lines
3.4 KiB
Smali
150 lines
3.4 KiB
Smali
.class public Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;
|
|
.super Ljava/io/InputStream;
|
|
.source "ByteBufferInputStream.java"
|
|
|
|
|
|
# instance fields
|
|
.field public byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/io/InputStream;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(I)V
|
|
.locals 0
|
|
|
|
invoke-static {p1}, Ljava/nio/ByteBuffer;->allocate(I)Ljava/nio/ByteBuffer;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;-><init>(Ljava/nio/ByteBuffer;)V
|
|
|
|
iget-object p1, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
invoke-virtual {p1}, Ljava/nio/ByteBuffer;->flip()Ljava/nio/Buffer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(Ljava/nio/ByteBuffer;)V
|
|
.locals 0
|
|
|
|
invoke-direct {p0}, Ljava/io/InputStream;-><init>()V
|
|
|
|
iput-object p1, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public available()I
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->remaining()I
|
|
|
|
move-result v0
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public getByteBuffer()Ljava/nio/ByteBuffer;
|
|
.locals 1
|
|
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
return-object v0
|
|
.end method
|
|
|
|
.method public read()I
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->hasRemaining()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const/4 v0, -0x1
|
|
|
|
return v0
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->get()B
|
|
|
|
move-result v0
|
|
|
|
and-int/lit16 v0, v0, 0xff
|
|
|
|
return v0
|
|
.end method
|
|
|
|
.method public read([BII)I
|
|
.locals 1
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Ljava/io/IOException;
|
|
}
|
|
.end annotation
|
|
|
|
if-nez p3, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
invoke-virtual {v0}, Ljava/nio/ByteBuffer;->remaining()I
|
|
|
|
move-result v0
|
|
|
|
invoke-static {v0, p3}, Ljava/lang/Math;->min(II)I
|
|
|
|
move-result p3
|
|
|
|
if-nez p3, :cond_1
|
|
|
|
const/4 p1, -0x1
|
|
|
|
return p1
|
|
|
|
:cond_1
|
|
iget-object v0, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
invoke-virtual {v0, p1, p2, p3}, Ljava/nio/ByteBuffer;->get([BII)Ljava/nio/ByteBuffer;
|
|
|
|
return p3
|
|
.end method
|
|
|
|
.method public setByteBuffer(Ljava/nio/ByteBuffer;)V
|
|
.locals 0
|
|
|
|
iput-object p1, p0, Lcom/esotericsoftware/kryo/io/ByteBufferInputStream;->byteBuffer:Ljava/nio/ByteBuffer;
|
|
|
|
return-void
|
|
.end method
|